Scripts in Head are added and executed twice (also in basic-example). Should we add an identifier?
I noticed that scripts returned from the head function are returned and executed twice. This happens both with referring to a script like
src: '/customScript.js'
and also if you define it as children: "(function(){ console.log("Hello")})()"
I think this is a bug, but perhaps there is a need to an identifier to it so tanstack start understands it are the same scripts?

4 Replies
conscious-sapphire•3mo ago
depending on how you're injecting those script tags, it could just be because of React strict mode which always render twice for each render, to spot render bugs
how are you adding those script tags ?
wise-whiteOP•3mo ago
I considered that, but all other head tags don't have this issue.
If you check out https://tanstack.com/start/latest/docs/framework/react/examples/start-basic
you can see it for example (codesandbox is having issues, but If I clone it locally I see the issue)
React TanStack Start Start Basic Example | TanStack Start Docs
An example showing how to implement Start Basic in React using TanStack Start.
conscious-sapphire•3mo ago
for me (when cloning), the script doesnt even run :Thonk:
and it does appear twice in the dom
@crybbie i figure you should create an issue on github, i dont think there's much room for anything other than it being a bug
wise-whiteOP•3mo ago
Makes sense!