You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 365f37d
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(web): spread applies attributes before children, matching ssrElement (#3741) (#3757)
A dynamic() / <Dynamic> element whose prop getter mints a hydration id (a
ternary over a signal compiles to a condition memo inside the getter) and
whose children include an element hydrated with a key miss: the client's
runtime spread() inserted `children` before its attribute effect read the
getters, while the server's ssrElement read attributes first. Both draw on
the enclosing component's id counter, so the memo and the child element
swapped ids and the server's child was never claimed.
spread() now creates its attribute effect before the children insert -- the
order a compiled element already uses (its spread/attribute effects precede
its children inserts). ssrElement defers reading a `children` prop until
after every attribute (and the trailing compiled attribute thunk), so a
`children` key listed before an id-minting attribute agrees too.
Side effect on the client: a ref on a dynamic() element now runs before its
children are inserted, as on a compiled element.
Size: page: base +59 B brotli (+1 B minified), layout only; frozen cap
raised 46.20 -> 46.24 KB with a Size-Exception note.
Fixes#3741
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Fix a hydration key miss on a `dynamic()` / `<Dynamic>` element whose prop getter mints a hydration id (a conditional expression over a signal compiles to a condition memo) and whose children include an element (#3741). The client's runtime `spread` inserted `children` before running its attribute effect, while the server's `ssrElement` read attributes first, so the memo and the child element took each other's ids and the child was rebuilt instead of claimed. `spread` now applies attributes before inserting children — the order a compiled element already uses — and `ssrElement` reads a `children` prop after every attribute regardless of key order. Observable on the client: a `ref` on a `dynamic()` element now runs before its children are inserted, as it does on a compiled element.
0 commit comments