Repository navigation
Wire a declared button's activation when it is declared, not at paint - #1968
Merged
Merged
Conversation
A native button's click listener, which runs its declared command, was added only by `reflectButtons` on the next repaint after the declaration. A press reaching a button in between did nothing. The margin card's thread step (`test_a_shared_passage_steps_between_single_thread_cards`) showed it: Next builds the second thread's card and focuses it, and `r` pressed right away ran the thread scope's resolution row, which clicked a Resolve no listener had been attached to yet. No event was sent, so the card kept both threads. The test failed 17 of 18 concurrent runs and every serial run on main, and passed with a 300 ms pause before `r`. It started with #1788, which moved button activation into the command owner. `attachScope` now wires each button a declaration names as an element when the declaration is made. A control named by a getter may not exist yet, and is still wired at paint. The listener resolves its command at the press either way, so availability and replacement keep their meaning. The margin test now passes 18 of 18 concurrent runs. A runtime test clicks a button before any paint, and fails without the change. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 7, 2026
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.
A declared native button only began answering its clicks once the next repaint ran
reflectButtons, which is where its click listener was attached. A press arriving between the declaration and that repaint did nothing.The margin card's thread step showed it (
test_a_shared_passage_steps_between_single_thread_cards):r, pressed right away, runs the thread scope's resolution row, which clicks the new card's Resolve.resolveis sent and the card keeps both threads.On main the test failed 17 of 18 concurrent runs and every serial run. It passed when the test paused 300 ms before
r. Bisecting puts the start at #1788, which moved button activation into the command owner.attachScopenow wires each button a declaration names as an element when the declaration is made. A control named by a getter may not exist yet, so it is still wired at paint. The listener resolves its command at the press, as before, so availability, replacement and refusal keep their meaning.The margin test now passes 18 of 18 concurrent runs. A new runtime test in
tests/runtime/command-controls.test.mjsclicks a button before any paint, and it fails without the change. These also pass:npm run test:runtime(228 tests).