Skip to content

fix: key the leaf menu's rows so a row it gains or loses moves the others - #6260

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6259
Nov 17, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-6259

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The leaf's menu drew its rows as an unkeyed array (rootTemplate in browser/runtime/floating-panel.js). When the menu gained or lost a row while it was drawn, Lit wrote each later row into its neighbour's old position. It removed and recreated equal buttons and the <hr> rule, and moved the copy shortcut's persistent wa-copy-button out and back. The write watch reports that churn as unchanged write: children of div.lf-fp-menu. The rows are now keyed by their seat key through repeat, so a row that comes or goes moves the rows around it and leaves them otherwise untouched. A user hits the same path whenever the menu's rows change while it is open, so the fix is in the menu's render, not in the test.

Since #6230, open_threads/open_panel_thread reach Threads through the leaf, which opens this menu. That is why test_a_reply_notice_survives_a_failed_state_and_keeps_its_agent began failing at teardown. It failed in both throttled runs (--cpu-throttle 4) on main and passed in 3 of 3 throttled runs with this change. A single paint (paintNow → Lit) made the whole write, which I confirmed by recording the stacks of the menu's DOM writes during a failing run. Twelve menu tests in test_render_floating_panel.py, pnpm run test:runtime and pnpm run check:browser pass.

Closes #6259 — automated triage

…hers

The menu drew its rows as an unkeyed array. When a row came or went
while the menu was drawn, Lit rewrote each later position with its
neighbour's row, removing and recreating equal buttons and the rule, and
moving the copy shortcut's element out and back. The write watch reports
that as an unchanged write to div.lf-fp-menu's children. Keying the
rows by their seat key moves rows instead.

Closes #6259
@leaf-agent
leaf-agent merged commit d81a1ff into main Nov 17, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6259 branch November 17, 2026 06:45
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.

test_a_reply_notice_survives_a_failed_state_and_keeps_its_agent: unchanged write to the leaf menu's children since #6230, under a slow CPU

1 participant