-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Hydratation of empty lists next to components. #3630
Conversation
an additional (empty) VText was inserted in the second reconciliation pass, which tried to insert itself in an invalid position. This internal error was masked by a "fix" of the internal slot of components, which should have still been trapped to signal that the second fixup render was not yet run.
Benchmark - coreYew Master
Pull Request
|
Visit the preview URL for this PR (updated for commit 24d815d): https://yew-rs-api--pr3630-hydrate-empty-list-zutzo0sl.web.app (expires Tue, 19 Mar 2024 11:13:26 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
11cbe10
to
24d815d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for taking the time to fix it
Description
Hydrating empty lists could fail when they were placed next to suspensions and other components. The underlying issue is caused by an historical extra empty text element that was used for empty lists to make them non-empty (and give other components a dom position to hook to). For hydration though, this extra element is basically a mismatch, so shouldn't exist. It was then added to Dom, which should have triggered an error
since it tries to insert itself before a component that hasn't received the
reuse
fix-up that notifies components of their hydrated siblings.Instead, the
DomSlot
of a hydrating component was reassigned to the first element of its fragment. Which is, in general, wrong: Note that hydrating a component or suspension keeps some of the nodes in Dom, but crucially, extra comment nodes to delimit fragments are removed. Hence, the component's internal slot would refer to such a comment node as its "position", but the comment node was then removed when the subsequent suspense was hydrated.Checklist