Skip to content

fix: mount a returning widget whose state Leaf set before its connectedCallback - #7557

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-7556
Nov 28, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-7556

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

A widget the host answers waits to mount until Leaf has set its state for the connection (#fresh in effect-widget.ts). #7542 had connectedCallback clear that flag before it dispatched lf-connect. But a subtree inserted at once is connected before any of its callbacks run, and a callback earlier in tree order can have the host set this element's state first. The host then makes no other set, so the root never mounts. That is what happens to the quoted lf-options in a thread reply. It mounts, leaves the page long enough for its root to close, and comes back with state set before its connectedCallback runs. From then on its shadow root holds only its styles and no <slot>, so its options have no box. A user saw the reply's quoted exhibit blank, and the test's click on #rp-memory (an option in that exhibit) timed out.

#fresh now records a state set made while the element stands in the document. It clears on disconnect, and after the constructor replays a property the page set before the upgrade, so that replay still doesn't count as Leaf's set. connectedCallback no longer clears it.

tests/browser/test_render_options.py::test_a_sample_in_a_reply_is_quoted_there_too fails on main (3eb3c6b1c) after its 120 s click timeout and passes with this change in 9 s. Also run: pnpm run test:runtime (1244 pass) and 16 focused browser tests on replies, samples, threads and redraws in test_render_options.py and test_render_drawing.py. The runtime suite has no test of this ordering because happy-dom connects each inserted node only as its own callback's turn comes, so it can't express this gap. The browser test is the reproduction.

Closes #7556 — automated triage

…edCallback

A widget the host answers waits to mount until Leaf has set `state` for the
connection (`#fresh`). `connectedCallback` cleared that flag, but a subtree
inserted at once is connected before any of its callbacks run, and a callback
earlier in tree order can have the host set this element's `state` first.
The host then makes no other set, so the root never mounted. A quoted
`lf-options` in a thread reply, which comes back after leaving the page long
enough for its root to close, drew an empty shadow root: its options had no
box and could not be seen or clicked.

`#fresh` now records a set made while the element stands in the document,
and clears on disconnect and after the upgrade's replay of a page's own
property, instead of in `connectedCallback`.

tests/browser/test_render_options.py::test_a_sample_in_a_reply_is_quoted_there_too
fails on main after its 120 s click timeout and passes with this change.

Closes #7556
@max-sixty
max-sixty merged commit b8d425d into main Nov 28, 2026
8 checks passed
@max-sixty
max-sixty deleted the fix/issue-7556 branch November 28, 2026 22:13
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_sample_in_a_reply_is_quoted_there_too: a live option in a panel reply is never visible since #7542

2 participants