Components using data-superjson attribute have their DOM unnecessarily recreated #109
Open
1 task done
Labels
bug
Something isn't working
Verify Next.js canary release
Describe the bug
When the react server components are refreshed (e.g. via
router.refresh()
), any component withdata-superjson
has its DOM tree entirely replaced—this clears things like input state, scroll position, etc and hurts performance.Here is a minimal reproduction: https://codesandbox.io/p/devbox/fwl4ws?file=/app/page.tsx
Enter values in both textboxes & note when the server refreshes, the normal
<input>
retains its state, but the<input>
inside thedata-superjson
component is replaced with new dom elementsExpected behavior
The DOM elements should only be unmounted/remounted as normally expected by the rules of React
Reproduction link
https://codesandbox.io/p/devbox/fwl4ws?file=/app/page.tsx
Version
0.6.3
Config
Additional context
No response
The text was updated successfully, but these errors were encountered: