-
Notifications
You must be signed in to change notification settings - Fork 247
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
Head scripts are reappended and reexecuted on navigation #381
Comments
Script in generated page has this outerHTML:
while dynamically created script has this:
so then those fail vue-meta/src/client/updaters/tag.js Line 63 in 2775c2d
because async attribute value is different.
SSR page when using |
@pimlie But I don't think you can reproduce that on CSB as this bug only reproduces with And sorry but I haven't tested v2 rc as I have troubles figuring out how to plug in that version into existing dependencies. Tried linking vue-app and vue-renderer from my local nuxt checkout but got |
You can install v2rc by running I actually did run the generate on csb. I couldnt add extra yarn scripts it seems so I first ran yarn generate, then I changed the generate script in package.json to be the npx command (and added -p 3000) then deliberately added an error to nuxt.config so nuxt dev would fail to run (and port 3000 was available), clicked on yarn generate which now started the http-server et voila :) |
@pimlie but Or am I wrong? I can still see references to |
The quickest way to check if you are running v2 is load your Nuxt app in the browser and check |
|
And actually with v2 it reproduces both when using |
Transferred this to vue-meta repo as it appears to be a vue-meta bug indeed. More strangely, apparantly I even deliberately 'fixed' the tests to include this difference: https://github.com/nuxt/vue-meta/blob/master/test/utils/meta-info-data.js#L127 Will have a look tomorrow whether that was just a brain fart or that there was more to it. |
This should be fixed now. Seemed to just have been an oversight, not a brain fart as so much ;) (fix will be released this weekend) |
Hi @pimlie, After much struggle I've decided with about 99% certainty that this bug is what is causing this other bug: nuxt-modules/google-adsense#16 The google adsense code placed in the head is ran once in dev mode but with I used yarn to resolve |
Hmm I think I'm running into this issue right now with nuxt build --spa. Was the fix released? Edit: I will create a new issue |
@snapwich I agree. I initially had the issue with I think this should be re-opened? |
Version
2.7.1
Reproduction link
https://github.com/guanzo/codesandbox-nuxt
Steps to reproduce
Open the webpage and dev tools, go to the Elements tab, expand the
<head>
nodeNote the position of the element
Note the element
<div id="arc-widget"></div>
at the bottom of<body>
. This element is created when thearc.io/widget.js
script is loaded.Click the "test" link
The
<head>
is updated and the script has been appended to the bottom of<head>
, causing it to execute again, and now there are 2#arc-widget
elements.What is expected ?
A script is loaded once across all navigations.
What is actually happening?
A script is loaded twice across all navigations.
Additional comments?
Related to nuxt/nuxt#3396.
This only occurs when each nuxt page has its own title. When nuxt updates the page title on navigation, the script is reappended. The
hid
attribute on the script tag doesn't fix it.The text was updated successfully, but these errors were encountered: