Repository navigation
fix: mount a returning widget whose state Leaf set before its connectedCallback - #7557
Merged
Merged
Conversation
…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
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 widget the host answers waits to mount until Leaf has set its
statefor the connection (#freshineffect-widget.ts). #7542 hadconnectedCallbackclear that flag before it dispatchedlf-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'sstatefirst. The host then makes no other set, so the root never mounts. That is what happens to the quotedlf-optionsin a thread reply. It mounts, leaves the page long enough for its root to close, and comes back withstateset before itsconnectedCallbackruns. 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.#freshnow records astateset 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.connectedCallbackno longer clears it.tests/browser/test_render_options.py::test_a_sample_in_a_reply_is_quoted_there_toofails 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 intest_render_options.pyandtest_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