Skip to content

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

Open
j15z wants to merge 5 commits into
feat/table-fksfrom
feat/reference-row-preview
Open

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

Conversation

@j15z

@j15z j15z commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Populated Reference cells now render as chips labeled with the Reference column name. Clicking a chip expands the matching referenced row directly beneath its source row; missing row IDs show zero matches instead of failing the grid.

The inline preview stays anchored to the visible left edge through full-range horizontal scrolling. Its nested columns scroll independently, use flush square grid chrome, and keep the outer row dividers aligned with the source table grid.

Stack

This is the second layer of the Reference-row stack and depends on #7105. It adds inspection only; an “Open in sub view” action remains deliberately deferred.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • 71 focused table-grid, query-cache, and column-registry tests pass.
  • bun run type-check passes across the workspace; the final app-only type-check also passes.
  • bun run check:api-validation passes.
  • Manually exercised opening, closing, and switching previews plus dragging the main grid to its far-right horizontal limit.

Reviewers should focus on the zero-width sticky viewport anchor, one-row virtualization sizing, and referenced-row cache invalidation.

Checklist

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

Screenshots/Videos

Not attached. The layout was refined against local browser screenshots at the left edge, intermediate positions, and the far-right scroll limit.

Post-Deploy Monitoring & Validation

  • Open valid, missing, and retargeted Reference values and confirm the correct inline state.
  • Verify the preview remains left-anchored while the main grid and nested subtable scroll independently.
  • Watch single-row read failures and client contract-validation errors for referenced-row cache drift.

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 26, 2026 5:38pm

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

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 apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx, double-clicking a reference chip can both open its preview and enter cell inline-edit mode because the event bubbles; stop propagation on the chip, consistent with URL cells.
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

Comment on lines +409 to +412
onClick={(event) => {
event.stopPropagation()
referenceAction?.onClick()
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/cells/cell-render.tsx, line 409:

<comment>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.</comment>

<file context>
@@ -375,6 +397,25 @@ export function CellRender({ kind, isEditing }: CellRenderProps): React.ReactEle
+          aria-expanded={referenceAction?.expanded}
+          disabled={!referenceAction}
+          className={cn('h-5 max-w-full', isEditing && 'invisible')}
+          onClick={(event) => {
+            event.stopPropagation()
+            referenceAction?.onClick()
</file context>
Suggested change
onClick={(event) => {
event.stopPropagation()
referenceAction?.onClick()
}}
onClick={(event) => {
event.stopPropagation()
referenceAction?.onClick()
}}
onDoubleClick={(event) => event.stopPropagation()}

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