Skip to content

Hand views only what they call, and drop what nothing uses (#118, #119) - #130

Merged
shovon merged 1 commit into
mainfrom
worktree-issue-118-119
Oct 28, 2026
Merged

shovon merged 1 commit into
mainfrom
worktree-issue-118-119

Conversation

@shovon

@shovon shovon commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Closes #118.
Closes #119.

What changed

#118: each view takes only the bridge calls it makes, and the ones of the views it renders. The types build up the tree:

  • StepsPages (PageView/steps/steps.ts): the five write calls the steps make.
  • PageViewPages (PageView.tsx): StepsPages plus search and deleteBlock, which PageView calls itself. LinkedReferences takes the same type, since each cut it renders is a PageView.
  • ProjectViewPages (ProjectView.tsx): PageViewPages plus the ten calls ProjectView makes itself (onChanged, show, locate, go, back, rezoom, addImage, addBlock, indentBlock, blockMenu). App's pages prop is exactly this.

A call added to a child shows up in its parents' types with no edit to them. ProjectView also loses its availability prop, which it never read.

#119: what nothing used is gone.

  • formatLastOpened and AVAILABILITY_LABEL in app/src/renderer/ui.ts were imported nowhere. formatLastOpened was also the renderer's one Date.now() outside index.tsx. ui.ts now holds only Act.
  • getLogStatus(view) in pages-store.ts returned view.status and nothing else. The session's status reads view.status, and the function's comment moves onto the status field of PagesView.
  • getPage was the third item in the issue. pages: queries take the fold state, not the whole view #113 kept getPage as the public query and dropped pageOf, so there is nothing left to do there.

app/CLAUDE.md no longer names getLogStatus.

For the reviewer

  • One runtime change: App no longer calls projects.availability. It fetched each project's reachability after every refresh only to pass it to ProjectView's unread prop, so nothing on screen changes. The projects:availability channel, its preload entry and store.checkAvailability all stay, per "Before removing anything" in app/CLAUDE.md. A comment in App.refresh says the fetch comes back with the code that draws it.
  • Everything else is type-only or a removal. The stories pass their stubs unchanged; a stub with more calls than a view takes is still one.

Tests

  • No new tests: there is no new behaviour. Typecheck is the check for Hand views only the bridge calls they make #118, and it covers the stories.
  • End to end, in a scratch instance (its own --user-data-dir and a scratch project): with the project opened and the window reloaded, the journal loaded without the availability fetch, pages.status() answered through the session, and a block typed through the view's box was written.
  • npm test (201 tests across all workspaces), npm run typecheck and npm run lint pass.

🤖 Generated with Claude Code

Views were handed more of the bridge than they used. ProjectView and
PageView took all of PagesApi, LinkedReferences took all of it to pass on,
and ProjectView declared an availability prop it never read, which App
fetched for every project only to pass it.

Each view's bridge prop is now what it calls and what the views it renders
call: StepsPages beside the steps, PageViewPages as that plus search and
deleteBlock (LinkedReferences takes the same, since each cut is a PageView),
and ProjectViewPages as PageViewPages plus ProjectView's own ten calls,
which is what App takes. ProjectView loses availability, and App stops
fetching it. The projects:availability channel and the bridge stay.

formatLastOpened and AVAILABILITY_LABEL in ui.ts were imported nowhere, and
formatLastOpened was the renderer's one Date.now() outside index.tsx;
ui.ts now holds only Act. getLogStatus returned view.status and nothing
else: the session reads view.status, and the comment moves onto that field.
getPage was already the one kept by #113.

No behaviour changes beyond App no longer asking for reachability nothing
shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shovon
shovon merged commit 8e201f2 into main Oct 28, 2026
1 check passed
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.

Remove unused display helpers and pass-through wrappers Hand views only the bridge calls they make

1 participant