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 084e621
Browse filesBrowse the repository at this point in the historyBrowse files
fix(web): decide SSR text separators on resolved values (#3383) (#3394)
* fix(web): decide SSR text separators on resolved values (#3383)
`resolveSSRNode` and `tryResolveString` emitted `<!--!$-->` between two
adjacent array items whenever both had a non-object static type — which
counted every function. Two neighbouring memos or components were
separated as if they were text even when both produced elements, so a
list of `Dynamic`, `Show`, or wrapper-library instances paid eight bytes
and a comment node per item, and the client removed each one on hydrate.
The client claims a multi-insert's nodes positionally after flattening
its value, so what matters is what each item RESOLVES to: two texts must
land in distinct text nodes; elements and template markup never need a
separator. Track "last appended was text" through the walk (`ssrTextTail`,
maintained at the leaves; arrays and functions pass it through; an
unresolved async hole still counts as text on both sides) and reset it
per independent region via the exported wrappers.
Deciding on the resolved value also separates text the old rule merged:
across a dropped nullish/boolean item (`[7, null, "x"]` → `7x`, one node)
and across a nested array boundary (`["a", ["b"]]` → `ab`). Both were
latent hydration mismatches — the second text item claimed nothing and
materialized a client node on the first update.
Parity harness: five scenarios covering the lists, the null gap, nested
arrays, and mixed memo results, plus two invariants — `adoptAll` (every
node is a server node after hydration AND after the update pass; a failed
text claim is invisible to textContent until the update) and
`noSeparators`. Against the previous walker, the server side emits
separators for both element lists and the hydrate side reports
`client-created text "x"` / `"b"` after update.
Co-authored-by: Cursor <[email protected]>
* test(web): type the memo-returning test components as JSX.Element
test-types failed on next's Component type (SolidElement return): the
#3383 fixtures return memos, valid children at runtime but not in the
type. Cast at the three sites, JSX imported from @solidjs/web.
Co-authored-by: Cursor <[email protected]>
* test(web): re-record the separator-dynamic-element-list artifact after #3393#3393 removed the trailing space before '>' on emitted tags; this
scenario was recorded before it landed.
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Cursor <[email protected]>
SSR emits the `<!--!$-->` text separator only between items that resolve to text. Adjacent memos and components that yield elements — every `Dynamic`, `Show`, or wrapper-library instance in a list — no longer carry a separator and a comment node each. Text that becomes adjacent through a nested array or a dropped nullish item is now separated, so it hydrates into distinct text nodes (#3383).
0 commit comments