-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(react-router, solid-router): make head function scripts load properly #4323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
but now this wont work during SSR anymore. so we need two different paths, one for SSR and one for client side rendering. |
@schiller-manuel I’ve updated the PR based on your feedback. During SSR, it renders a <script> tag as before. On the client side, it dynamically appends the script via useEffect. Let me know if there’s anything else I should improve. |
View your CI Pipeline Execution ↗ for commit 4d535f5.
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-with-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
Do we have e2e tests for this at all? |
yeah we need e2e tests for this. not necessarily in this PR. @brenelz can you add some in a different PR (that would fail now)? |
@w00khyung can you please add an e2e test for both react and solid? could be a route next to |
So a couple notes on this pr. It looks like the Solid version still fails the e2e test when client side navigating. The react one passes but the e2e tests seem to be doing a full page refresh. I'm not 100% sure why. We can very simply add a e2e test in
|
I’ll add e2e tests and look into the issue in Solid. |
The " client side navigating to a route with scripts " appear to be failing for both solid and react |
should we use this for solid? https://primitives.solidjs.community/package/script-loader/ |
thanks a lot for your contribution! |
#3687
Scripts returned from the head function in createFileRoute only get properly inserted and loaded when they have an async attribute. Scripts without the async attribute are not inserted at all.
Fixed the issue by modifying the ScriptAsset component in Asset.tsx to properly handle script loading through direct DOM manipulation.