fix: update sibling_slot immediately on component reuse#4093
Open
Madoshakalaka wants to merge 1 commit intomasterfrom
Open
fix: update sibling_slot immediately on component reuse#4093Madoshakalaka wants to merge 1 commit intomasterfrom
Madoshakalaka wants to merge 1 commit intomasterfrom
Conversation
During parent reconciliation, BComp::reconcile deferred the sibling_slot update to the scheduler via PropsUpdateRunner. The returned own_position chains through sibling_slot, so for components with empty output the stale reference could point to a node already detached earlier in the same reconciliation pass, causing insertBefore to fail with NotFoundError. Reassign sibling_slot synchronously in Scope::reuse before scheduling the props update so the slot chain resolves correctly while the parent is still reconciling.
Benchmark - coreYew MasterPull Request |
|
Visit the preview URL for this PR (updated for commit 3c9adc7): https://yew-rs-api--pr4093-fix-insert-before-cr-gzekan40.web.app (expires Mon, 06 Apr 2026 11:02:42 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Size ComparisonDetails
✅ None of the examples has changed their size significantly. |
Benchmark - SSRYew MasterDetails
Pull RequestDetails
|
Contributor
|
Thanks so much for the quick investigation and fix! I can confirm this fixes my app: [patch.crates-io]
yew = { git = "https://github.com/yewstack/yew.git", branch = "fix/insert-before-crash" } |
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.
Fixes #4092
Impacted usage patterns
The bug requires three children in a sibling list, left to right:
Opposing conditionals with an empty component between them
State-driven show/hide swap
Empty list gaining items while a sibling disappears
Multiple empty components
In all cases, the "empty component" can be anything whose rendered output produces zero DOM nodes:
html! {},html! { if false { <div/> } }, or a component wrapping another empty component.Checklist