Repository navigation
Keep a large notes tree fast while typing - #264
Merged
Merged
Conversation
Each row of the Space notes tree scanned every node for its children, built its Move to list twice, and named each target by walking its parents with more scans, even with the menu closed. Space re-renders the tree on every keystroke in a page, so typing paid for all of it. The tree now indexes its nodes once per tree, builds a row's Move to list only while its menu is open (and a drag's targets once per drag), and keeps its rows while nothing they show changes. Space hands it one lasting actions object, so editing a page body leaves the tree alone. Server-rendered with every menu closed, median of five: 1,051 nodes, 55 folders: 547 ms -> 44 ms 2,101 nodes, 110 folders: 3,362 ms -> 80 ms A new test renders the tree with its nodes behind a counting proxy. Before, a render read each node about 89,000 times; now once. Part of #241. Coven-Harness: Claude Code / claude-opus-5-5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage-agent
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Coven-Harness: Claude Code / claude-opus-5-5
# Conflicts: # docs/status.md
# Conflicts: # docs/status.md
This was referenced Oct 18, 2026
BunsDev
added a commit
that referenced
this pull request
Oct 19, 2026
… and the routines spec (#310) v0.2.0 was published on 2026-10-18 (23:14Z) from the signed tag on 01b1b8a. This follows Val's status layout (#290): - Shipped gains a v0.2.0 row linking its release and its review. - The 13 "On main, unreleased" items move unchanged to a new "Status summary" at the end of the v0.2.0 review, along with the old In flight entry. Each one was introduced by a commit in the tag (#248, #253, #254, #257 to #261, #263, #264, #266, #267, #269). The CF slices and #283's Markdown parser came after the tag, so they stay. - In flight keeps a short follow-ups entry for the gates no receipt records yet: the independent download checks, the banner upgrade on the release Mac, and the Companion 0.2.0 (7) TestFlight upload. - The routines spec and the README now say Phase 1, and most of Phase 0, ship from v0.2.0. Unchanged: the website's static fallback (apps/site/release.json) and the release evidence, which stay with the release owner. Claimed on #290. Coven-Harness: Claude Code / claude-opus-5-5
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #241 (finding 6: tree render cost grows with the square of the tree size, on every keystroke).
Problem
In
NotesTree.tsxevery row filtered all nodes for its children, built its Move to targets twice (each a scan for descendants plus a scan for targets), and named every target by walking its parents withtree.nodes.find. The Move to items were built even while the menu was closed.SpaceViewre-renders on each page edit and passed a newpagesarray and a new actions object every time, so the whole tree re-rendered on every keystroke. The reviewer measured 1,056 nodes / 55 folders at 343 ms per render and 2,111 / 110 at 2.9 s.Fix
space/tree-index.ts:indexTree(tree)builds id and parent→children maps in one pass;NotesTreeViewmemoizes it per tree.targetsForkeeps the same rule and order as before (a container that may hold the node, not its parent, not itself or anything under its path) and runs only when asked.useMemoover what they show: the index, page titles, selection, focus, the actions and the tree's own state). Page titles are compared by value, so editing a page body does not rebuild them. This does the jobReact.memowould, without rewriting theNotesTreeViewsignature line that the finding 9 change edits.useTreeActionsgives the tree one lasting actions object whose methods call Space's latest, so Space's re-renders do not invalidate the rows.NotesTreeView's signature and the New workspace effect are unchanged, so this does not overlap the finding 9 change; the finding 8 code inSpaceViewis untouched.Before / after
Server-rendered with every menu closed, median of five, on a loaded Mac:
On top of that, typing in a page body keeps the rows as they are, so a keystroke there does not redraw the tree at all. The new test cannot re-render (it renders on the server), so that part follows from the memoized rows and stable actions rather than from a measurement; the e2e specs below confirm the tree still behaves the same.
Regression test
apps/desktop/test/notes-tree-render.test.tsloads the realNotesTree.tsxthrough Vite's SSR loader (Vite and the React plugin are existing dev dependencies), renders the reviewer-sized trees withtree.nodesbehind a proxy that counts element reads, and allows four reads per node. On the unmodified code it fails at once (1051 nodes: read more than 4204 nodes to render; an unbounded count is 94,126,002 reads, about 89,000 per node). After the fix a render reads each node once. The budget also catches Move to lists built for closed menus, since each one scans the nodes. The test checks too that every row renders, in tree order. A second test coversindexTree: children order, and Move to targets for a note, a folder (not its project, itself or its subfolder, but a sibling whose name starts the same), a project and a workspace.Ran
pnpm build && pnpm test: all pass (desktop: 1,423 passed, 16 skipped, 0 failed; core, worktree scripts, site and store suites all pass)pnpm --filter @modex/desktop typecheck: passespnpm exec playwright test e2e/notes-tree.spec.ts e2e/space.spec.ts e2e/notes.spec.ts e2e/notes-files.spec.ts e2e/space-fit.spec.ts: 32 passed;e2e/sidebar-workspaces.spec.ts(New workspace and Open notes focus through the tree): 2 passedCoven-Harness: Claude Code / claude-opus-5-5