-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Unable to use dangerouslySetInnerHTML
and beforeInteractive
strategy in Script component
#31275
Comments
Has anyone found a workaround for this? What I currently do is placing the javascript on a file on the public folder and load it from there, but it does not allow me to use environment variables in order to change parameters. |
Hi, this has bee updated in the latest version of Next.js |
Hi, checked it today. Seems it's still not working with v12.1.6. Browser - Chrome 101.0.4951.64 |
- Fixes #36997 - Fixes #31275 @janicklas-ralph Any idea why tests were passing while this check was failing? Can we add a stronger test for this?
Hi, this has been updated in |
v12.1.7-canary.8 Still break; the script has unknow src , and the inline script dont execute @ijjk @housseindjirdeh |
the "scriptProps" should omit src next.js/packages/next/client/script.tsx Line 172 in 5acf9db
updateScripts always post it @ijjk |
BeforeInteractive inline script in v12.1.7-canary.8 don't run. Beacause the script has unknow src. ![image](https://user-images.githubusercontent.com/17813559/169257330-4419228a-6d10-4815-9451-d9a5dd7f011b.png) Fixes #31275 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
14.17.1
What version of Node.js are you using?
12.0.3
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
npm run dev
Describe the Bug
Setting
dangerouslySetInnerHtml
in next Script component while also specifyingbeforeInteractive
strategy will result in the Script component doing nothing. Since there is nosrc
specified, the src will simply be(unknown)
.Expected Behavior
Script component can be used with no
src
while usingdangerouslySetInnerHtml
property.To Reproduce
Try to render Script component using
beforeInteractive
while having nourl
and specifyingdangerouslySetInnerHtml
property.This piece of code of next Script will result in the following script tag being added
The text was updated successfully, but these errors were encountered: