#453

fix: stop spec replay from mutating message parts

OpenRaillywants to merge intofrom

Problem

buildSpecFromParts (react, vue, solid) and devtools extractSpecFromParts applied patch values by reference, so later patches wrote into the message parts themselves. Building a spec from the same parts again, on a remount or in the devtools generation switcher, re-applied index and append patches (/state/posts/0, /children/-) on top of the mutated values and duplicated state items and children. The spec from the first build changed too, because it shares those arrays. The system prompt teaches this pattern for state arrays. Svelte was not affected, since it already snapshots each patch.

Changes

  • Deep-copy part data before applying it in all four replay functions. The copy is JSON, because structuredClone throws on Vue reactive proxies.
  • A replay test per package that builds the same parts twice and expects the same spec; each one fails on main.

Visual proof

useJsonRenderMessage with the same parts, mounted, unmounted and mounted again:

Activity

4
vercel[bot]8d ago

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated
json-render ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-chat-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-dashboard-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-game-engine-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-image-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-no-ai ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-react-email-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-react-pdf-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-react-three-fiber-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-remotion-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-solid-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-svelte-chat-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-svelte-demo ReadyPreview, v0Nov 5, 2026 6:38am UTC
json-render-vue ReadyPreview, v0Nov 5, 2026 6:38am UTC
1 Skipped Deployment
ProjectDeploymentActionsUpdated
json-render-chat-sdk-demo Skippedv0Nov 5, 2026 6:38am UTC
ctatereviewed8d ago
lahfir8d ago

found the same as ctate! LGTM 🔥