TanStackT
TanStack3w ago
4 replies
sad-indigo

why does react router use an empty script tag for scroll restoration

traced with react devtools to here
https://github.com/TanStack/router/blob/8628d0189412ccb8d3a01840aa18bac8295e18c8/packages/react-router/src/Match.tsx#L163

why does this have to be a script tag?

this tag breaks hydration when using the posthog package because it tries to insert it's script relative to this one, which causes it to nest a script right next to it. the temporary SSR scripts dont interfere since they auto-delete.
image.png
Was this page helpful?