Commit f5870b3
fix(tanstack-start): strip RegExp in toSerializable to unblock SSR bootstrap
Run #4's Map→object fix for versionViewData.clientSchemaMap landed but
the versions diff-view shard stayed 0/40. The actual blocker was a
separate non-serializable value in the payload — RegExp literals from
rich-text feature markdownTransformers (e.g. UPLOAD_PLACEHOLDER_REGEX,
/!\[([^\]:]+):([^\]]+)\]\(\)/).
toSerializable previously preserved RegExp unchanged. seroval then
serializes the regex into the SSR bootstrap script, but with doubled
backslashes in source (emits `/!\\[.../` instead of `/!\[.../`). That
is syntactically invalid JS regex ("Unmatched ')'"), so the script
that populates `window.$_TSR` throws mid-stream. TanStack hydration
then fails with "Invariant: Expected to find bootstrap data on
window.$_TSR", the client re-renders the tree empty, and the diff
wrapper never reaches the DOM — hence every test in
`versions/e2e.spec.ts › Versions diff view` timed out waiting for
`.render-field-diffs`.
Next.js doesn't hit this because its server→client transport is JSON,
which silently drops RegExp. Strip RegExp here to match that behavior.
Rich-text transformer regexes are server-only (markdown import/export)
and aren't referenced by buildVersionFields or any client renderer,
so the loss is harmless.
Verified locally against test/versions/config.ts: before, the page
stuck at the Invariant error with an empty client tree; after, the
bootstrap parses, hydration completes, and .render-field-diffs
renders through SSR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8229869 commit f5870b3
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
| |||
0 commit comments