Skip to content

fix(app): make kanban and gallery record expansion update the url - #3627

Open
nimser wants to merge 2 commits into
teableio:developfrom
nimser:fix/copy-record-url-kanban-gallery
Open

fix(app): make kanban and gallery record expansion update the url#3627
nimser wants to merge 2 commits into
teableio:developfrom
nimser:fix/copy-record-url-kanban-gallery

Conversation

@nimser

@nimser nimser commented Aug 7, 2026

Copy link
Copy Markdown

Closes #3626

Problem

In the kanban and gallery views, clicking a card expands the record by setting local component state only. The URL is never updated, so the expanded record has no recordId query param and the header's Copy record URL button (which copies window.location.href) returns the bare view URL:

https://host/base/bseXXX/table/tblXXX/viwXXX

The same record opened from the grid view gives the expected link, because grid expansion pushes recordId into the router:

https://host/base/bseXXX/table/tblXXX/viwXXX?recordId=recXXX

Fix

Expand through the router in kanban and gallery, like the grid view does:

  • new useExpandRecord hook pushing { ...router.query, recordId } (shallow)
  • KanbanCard / gallery Card use it on click and after record insertion
  • record history / comment handlers no longer set the local state twice: they already push the record id through the router
  • setExpandRecordId removed from the kanban and gallery contexts: once the cards expand through the router it has no consumer left, and leaving a state setter in a shared context invites the same bug again. The providers keep their local state, synced from router.query.recordId. Happy to keep the contexts untouched if you prefer a strictly minimal diff

Closing the expanded record already resets the query in both providers, so no change was needed there.

Notes

  • The calendar view has the same class of bug, but its provider does not read recordId from the router at all, so fixing it needs a larger change; left out to keep this PR focused.

Tests

useExpandRecord.spec.ts (vitest, renderHook + mocked next/router, same pattern as useImageModelUiState.spec.ts and DataDbBadge.spec.tsx) asserts the shallow push carrying recordId. The playwright suite under apps/nextjs-app/e2e only covers static pages and is not wired into CI, so no e2e was added.

Verification

  • pnpm typecheck in apps/nextjs-app: pass
  • vitest run src/features/app/blocks/view/hooks/useExpandRecord.spec.ts: pass
  • eslint on the touched directories: clean
  • manual, local dev stack (postgres + redis in docker, pnpm dev): before the fix, clicking a kanban card expands the record and the URL stays .../viwXXX; after the fix it becomes .../viwXXX?recordId=recXXX, closing the record resets it, and the gallery view behaves the same

nimser added 2 commits August 7, 2026 19:05
Cards opened their record by setting local state only, so the url kept
pointing at the view and "copy record url" returned a link without
recordId. Expanding now goes through the router, like the grid view.
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.

Copy record URL returns the view URL when the record is expanded from a kanban or gallery view

1 participant