Commit 4419951
authored
feat(realtime): live workspace tables list, sharing one invalidation-room impl (#6053)
* feat(realtime): live workspace tables list, sharing one invalidation-room impl
Bring the tables list to parity with the files list: a create/rename/move/delete/
restore now propagates to every viewer live instead of waiting out the 30s
staleTime. Following the files pattern, but factoring the two into one shared
implementation rather than copy-pasting.
- add ROOM_TYPES.WORKSPACE_TABLES + its authz resolver (workspace-id-addressed,
reuses the workspace resolver like workspace-files)
- extract setupWorkspaceInvalidationRoom (server) and useWorkspaceInvalidationRoom
(client) — the presence-free, workspace-scoped live-list room; files and tables
now both bind to it, so they can never drift. Event/room names derive from the
room type. Replaces the standalone workspace-files handler + hook
- notifyWorkspaceTablesChanged fanout fired from the table service (createTable,
renameTable, moveTableToFolder, deleteTable, restoreTable) so it covers both the
HTTP routes AND copilot, which call the service directly
- relay /api/workspace-tables-changed endpoint; wire the hook into the tables page
- consolidate the handler test into one suite run against both room types
* feat(realtime): live tables list also covers table-folder mutations
Fold in the follow-up: a table folder create/rename/move/delete/restore now
propagates to the tables list live too, so the browser is fully consistent.
- generic notifyFolderResourceChanged(resourceType, workspaceId) dispatches the
workspace live-list signal by resource type (a map, not a special-case if), so
file/knowledge_base/workflow are no-ops today and gain liveness by adding a map
entry when they adopt an invalidation room
- fired from the shared folder lifecycle (createFolder/updateFolder/deleteFolder/
restoreFolder), covering routes AND copilot
- the tables room hook now invalidates the table folders query too, not just the
tables list, since the page renders both
* fix(realtime): skip per-table live-list notify during a folder cascade
A folder delete/restore already fires one folder-level notifyFolderResourceChanged
for the whole subtree, but the cascade also calls deleteTable/restoreTable per
table — each awaiting its own notifyWorkspaceTablesChanged. A folder with many
tables would run N+1 sequential relay calls (each bounded by NOTIFY_TIMEOUT_MS),
blocking the mutation. Add a skipNotify option the cascade passes so only the one
folder-level notify fires.1 parent c639d61 commit 4419951
15 files changed
Lines changed: 548 additions & 370 deletions
File tree
- apps
- realtime/src
- handlers
- routes
- sim
- app/workspace/[workspaceId]
- files/hooks
- hooks
- tables
- hooks
- lib
- folders
- realtime
- table
- packages
- platform-authz/src
- realtime-protocol/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
This file was deleted.
0 commit comments