Open douglasrcjames opened 1 year ago
I am facing similar issue as well
I am facing similar issue as well
Same issue here and noway to solve it.
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote π on the issue description or subscribe to the issue for updates. Thanks!
same problem
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote π on the issue description or subscribe to the issue for updates. Thanks!
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/inspiring-moore-jgg9v2
To Reproduce
Generally just navigating back and fourth between pages via tags and eventually landing on the "services" page will fail to load the Twitter script. This issue can be reproduced with all external scripts I have tried. If you simply forced the browser refresh, the script will load fine.
Current vs. Expected behavior
Currently Script loads on the initial load of the route, but doesn't load if you leave the route then return the route with the script. Expected that the script should be loaded without the need to refresh the page manually with the browser button, and on every route changes via Links not just the first load.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Routing (next/router, next/navigation, next/link), Script optimization (next/script)
Additional context
I have tested a bunch of solutions, such as loading the Script inside the layout component as suggested here, but still no dice. I have tried every
strategy
prop from the docs, and all the same result. This has worked with 4 different external scripts from different websites (Twitter, Instagram, DICE, and SweepWidget). There's a chance I am misusing the component, but I am thinking not. I am out of troubleshooting steps!The only usage of external scripts I have been able to get to work for my use case is the hacky component below for an external library that needed an
onLoad
function to be run, and the script seems to load every time as expected (live here)