Skip to content

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

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

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

Conversation

@nimser

@nimser nimser commented Aug 7, 2026

Copy link
Copy Markdown
Owner

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

  • No upstream issue reports this: GitHub issue search on teableio/teable for kanban, copy record url, record link, copy link, recordId, deep link, share record, url view returns nothing on this behaviour. An issue will be filed together with the upstream PR.

  • 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.
@nimser

nimser commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR teableio#3627 (issue teableio#3626). Kept the branch as is; closing this review PR.

@nimser nimser closed this Aug 7, 2026
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