Closed WorldSEnder closed 3 months ago
vnode fastest │ slowest │ median │ mean │ samples │ iters
╰─ vnode_clone 2.79 ns │ 4.015 ns │ 3.686 ns │ 3.468 ns │ 100 │ 1000000000
vnode fastest │ slowest │ median │ mean │ samples │ iters
╰─ vnode_clone 2.809 ns │ 3.995 ns │ 3.709 ns │ 3.409 ns │ 100 │ 1000000000
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 🌎
✅ None of the examples has changed their size significantly.
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