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 7f6332a
Browse filesBrowse the repository at this point in the historyBrowse files
perf(web): spread() creates fewer reactive nodes and accepts a sources array (#3388) (#3419)
`ref` folds into the attribute effect: it is collected with the other props
in the compute half and re-applied in the commit half only when its identity
differs from the last applied one. `ref()` runs the callback untracked with
no owner, so nothing a ref creates is disposed when the effect reruns; that
is what makes the fold safe.
Children keep their own owned `insert`. That effect owns the child subtree
(components, memos and effects created while the children getter runs are
disposed when it reruns), so merging it into the attribute effect would tear
the children down and rebuild them on every attribute change. A plain object
whose `children` is a data property inserts the value with no effect at all.
Three nodes become two when children flow through the spread, one when they
don't.
`spread(el, [a, b], skipChildren, skip)` takes an array of sources: the
union of own string keys with later sources winning, only the winning source
read, function sources called inline with no memo and so no hydration id,
`skip(key)` never read nor applied. Same contract as the server `ssrElement`
array form. Web effects are transparent for hydration ids, so dropping the
ref effect shifts no sibling ids.
Co-authored-by: Cursor <[email protected]>
`spread()` creates fewer reactive nodes per element (#3388): `ref` folds into the attribute effect and is re-applied only when its identity changes (refs run with no owner, so nothing they create is disposed by the fold); children keep their own owned `insert` — that effect owns the child subtree, and merging it would rebuild the children on every attribute change — but a plain object whose `children` is a data property inserts the value with no effect at all. Three nodes become two when children flow through the spread, one when they don't. `spread` also accepts an array of sources with an optional `skip` predicate — `spread(el, [a, b], skipChildren, skip)` — the union of own keys with later sources winning, only the winning source read, function sources called inline with no memo (and so no hydration id), matching the server `ssrElement` array form.
0 commit comments