Skip to content

feat(tables): preview referenced rows inline - #7106

Open
j15z wants to merge 1 commit into
feat/table-fksfrom
feat/reference-row-preview
Open

feat(tables): preview referenced rows inline#7106
j15z wants to merge 1 commit into
feat/table-fksfrom
feat/reference-row-preview

Conversation

@j15z

@j15z j15z commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Render Reference cells as table-name chips and preview the referenced row inline
  • Switch an open preview directly between referenced rows without closing it first
  • Preserve Reference integrity through table copying, cascading archive and restore, and row mutations
  • Gate Reference creation, conversion, retargeting, navigation, prefetching, and previews behind a global runtime flag while keeping existing values usable
  • Build on the Reference column foundation in feat(tables): add reference columns #7105

Type of Change

  • New feature

Testing

  • bun run type-check from apps/sim
  • bun run check:api-validation
  • bun run check:openapi
  • bun run check:cli-api
  • 18 focused test files with 318 passing tests

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added or updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 2, 2026 7:40am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds clickable chips for reference cells and an inline, virtualized preview of the referenced table row. It also introduces a single-row query and cache invalidation support for batch row updates.

  • Renders populated reference values as expandable column chips.
  • Fetches and displays referenced table schemas and rows inline.
  • Accounts for the expanded preview in row virtualization.
  • Adds row-detail query keys, tests, and batch-update invalidation.

Confidence Score: 4/5

The stale referenced-row preview should be fixed before merging because live row changes can leave users viewing outdated data.

The new detail query is independently cached, but existing realtime cell synchronization does not update or invalidate it, so a mounted preview can diverge from the referenced row.

Files Needing Attention: apps/sim/hooks/queries/tables.ts; apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/reference-row-preview.tsx

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx Adds expanded-reference state, row virtualization sizing, keyboard exclusions, and inline preview placement.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/reference-row-preview.tsx Adds the referenced-row preview UI and its loading, missing-row, error, and empty-schema states; one typography rule violation remains.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/data-row.tsx Derives preview targets from reference cell values and wires chip actions into each rendered row.
apps/sim/hooks/queries/tables.ts Adds the row-detail query and batch invalidation, but realtime cell changes do not reconcile the new cache entry.
apps/sim/lib/table/column-types/reference.ts Defines how reference columns derive their chip labels, target table IDs, and target row IDs.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant G as TableGrid
  participant P as ReferenceRowPreview
  participant Q as React Query
  participant A as Table API
  U->>G: Click reference chip
  G->>G: Expand source row and reserve preview height
  G->>P: Render referenced table and row IDs
  P->>Q: useTable + useTableRow
  Q->>A: Fetch schema and referenced row
  A-->>Q: Table definition and row
  Q-->>P: Cached preview data
  P-->>U: Render referenced row inline
Loading

Reviews (1): Last reviewed commit: "feat(tables): preview referenced rows in..." | Re-trigger Greptile

Comment on lines +344 to +350
return useQuery({
queryKey: tableKeys.row(tableId ?? '', rowId ?? ''),
queryFn: ({ signal }) =>
fetchTableRow(workspaceId as string, tableId as string, rowId as string, signal),
enabled: Boolean(workspaceId && tableId && rowId),
staleTime: TABLE_ROWS_STALE_TIME,
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Row preview cache diverges

When a workflow or another client updates a referenced row, realtime synchronization updates paginated row caches but leaves the new tableKeys.row entry unchanged, causing an expanded preview to continue displaying stale cell values until a later refetch.

Knowledge Base Used: Web application and product surfaces

<div className='flex h-full w-[100cqw] min-w-0 flex-col bg-[var(--surface-2)]'>
<div className='flex h-9 shrink-0 items-center gap-1.5 px-3 text-[var(--text-primary)] text-small'>
<ReferenceIcon className='size-[14px] text-[var(--text-icon)]' />
<span className='font-medium'>{table?.name ?? 'Referenced table'}</span>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Header weight overrides defaults

The new table-name span applies font-medium, overriding the canonical normal-weight typography and making the preview header inconsistent with established component styling.

Suggested change
<span className='font-medium'>{table?.name ?? 'Referenced table'}</span>
<span>{table?.name ?? 'Referenced table'}</span>

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found and verified against the latest diff

Confidence score: 4/5

  • In cell-render.tsx, double-clicking a reference chip can also trigger the cell’s inline edit mode after opening the preview, creating conflicting interactions; stop dblclick propagation on the chip to match URL cell behavior.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx">

<violation number="1" location="apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx:409">
P2: Double-clicking a reference chip still bubbles `dblclick` to the cell, so opening the preview can also enter inline edit mode. Stop double-click propagation on the chip, matching the URL cell behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant