The sidebar page tree only updated on other clients when a change was made via the UI tree, in an open tab, within a ~50ms client relay window — API/MCP/ AI/import changes never propagated. Move the source of truth to the server. Server: - Enrich PageEvent with thin TreeNodeSnapshot(s) so the WS listener never reads the DB (avoids the in-transaction visibility race). insertPage fills the create snapshot from its returning() row; removePage ships only the deleted subtree ROOT (client treeModel.remove drops descendants); restorePage carries spaceId. - New PAGE_MOVED event from movePage with old/new parent + position + snapshot (generic PAGE_UPDATED stays for content/rename). - WsService.emitTreeEvent mirrors emitCommentEvent (per-space restriction gate: spaceHasRestrictions -> hasRestrictedAncestor -> broadcastToAuthorizedUsers); author NOT excluded so non-UI creators see their own page (receiver is idempotent). - WsTreeService.broadcastPageCreated/Deleted/Moved + broadcastRefetchRoot; new PageWsListener (create/delete/move/restore) registered in WsModule. Client: - Remove the client relay (emit + setTimeout(50)) from create/move/delete; keep optimistic local updates. Make the optimistic create insert id-idempotent (find-then-skip) so the now-fast server addTreeNode broadcast can't race it into a duplicate row. addTreeNode inserts by fractional position among loaded siblings (consistent order across clients). Restore uses refetchRootTreeNodeEvent (robust for subtree re-attach). Rename/icon updateOne and cross-space move realtime are deferred (commented as follow-ups). Implements docs/backlog/realtime-tree-server-authoritative.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist