Open promise96319 opened 12 months ago
Oh my god, thanks, this was driving me crazy. I've been investigating for the last two days to understand why i have this error.. i didn't think the problem could be created from the strategy='beforeInteractive' If i go to the page through clicking a link i have the error, but if i refresh the page works Removing the script on layout.tsx the error seems to be disappeared
I do not use strategy='beforeInteractive' in my code but I also encountered this error. The fix in my case was to pin next to 13.5.4.
@Coyenn I have this issue too, if i recall correctly issue started on 13.5.6 version.
is there a workaround for this while it's being corrected ? It's driving me nuts!
Can confirm: still an issue, and I also tracked issue to 13.5.5
/13.5.6
before finding this topic.
As workaround I just putted my script to root layout.tsx in head tag (and disabled corresponding
<head>
<script src="https://cool-script.js" />
</head>
Really hoping for fix
Link to the code that reproduces this issue
https://github.com/promise96319/nextjs-dynamic-routing-error
To Reproduce
First, add a Script with
strategy='beforeInteractive'
inapp/layout.tsx
.Secondly, click the a link navigating to a dynamic routing,it will throw an error.
Current vs. Expected behavior
When there is a script with
strategy='beforeInteractive'
and navigate to a dynamic routing, the dynamic routing segment has been encoded for twice,like/_next/static/chunks/app/post/%255BdocId%255D/page.js
,but the correct file path is/_next/static/chunks/app/post/%5BdocId%5B/page.js
. The dynamic routing segment is not encoded correctly.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
No response