Skip to content

Key each leaves-drawer row by its page, not its address - #1892

Merged
max-sixty merged 2 commits into
mainfrom
stable-neighbor-rows
Oct 6, 2026
Merged

max-sixty merged 2 commits into
mainfrom
stable-neighbor-rows

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The Leaves drawer keyed each neighbour row, and the focus it keeps across a repaint, by the neighbour's URL. A neighbour whose server came back on another port therefore read as one page leaving and another arriving. The focused link was removed, and focus fell back to the drawer.

Each entry in state.others now carries page_key (state.page_key, the identity that page's state-home records already use) beside url. The drawer keys rows and focus by page_key and links by url. A restarted neighbour keeps its node and its focus, and Enter opens the new address. The fresh-server check is unchanged: a neighbour with no running server still leaves the list.

test_a_leaf_served_at_a_new_address_keeps_its_row_and_focus restarts a focused neighbour on a new port. It takes the route a taken port's refusal names: the service record is deleted, and the old port stays held. The test fails on main because the row lost its node and focus. With this change it passes. This resolves comparisons proposal #5, which is removed from notes/comparisons.md.

Is there a more underlying fix? No. I tried these candidates:

  • Enter on the retained link opens the new address. Covered in the new test.
  • The retained node's href follows the new URL. Covered in the new test.
  • Other code that reads a neighbour's identity: a grep of the runtime and the Python found none. presence.js reads only the neighbours' activity.
  • During a restart, the row is absent from the moment the old server stops until the new server publishes. A measurement showed about 70 ms of that gap falls after start_server returns and before the first row publication. The drawer treats an absent row as removal, and the proposal keeps that behaviour (it retains the fresh-server checks). So the gap is outside this change.
  • History: the keying lines have stayed as written since Make Leaf pages complete reactive applications #666 and Share one retained-face base and one activity reading across the banner, trays and thread list #1214, with no earlier patch to this condition.

Tests run: the new test (it fails on main and passes here); the drawer's browser tests in test_render_controls.py and test_render_navigation.py (49 passed); the neighbour tests in test_interact_server.py (21 passed); pre-commit.

This was written by Claude Code on behalf of max-sixty

A neighbour row in the Leaves drawer was keyed by its URL, for both Lit's
repeat and the focus it keeps across a repaint. A neighbour whose server came
back on another port therefore read as one page leaving and another arriving:
the focused link was removed and focus fell back to the drawer.

Each entry in `state.others` now carries `page_key`, the identity the page's
own state-home records already use, beside `url`. The drawer keys rows and
focus by `page_key` and links by `url`, so a restarted neighbour keeps its
node and focus and Enter opens the new address. A neighbour whose server is
not running still leaves the list, as before.

The new test restarts a neighbour on a new port while its link holds focus;
it fails on main. Removes proposal #5 from notes/comparisons.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit dc49218 into main Oct 6, 2026
3 checks passed
@max-sixty
max-sixty deleted the stable-neighbor-rows branch October 6, 2026 09:07
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.

2 participants