-
Notifications
You must be signed in to change notification settings - Fork 248
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
bug afterNavigation #475
Comments
Could you please try to add |
Sure, I'll try |
Its same |
// pages/page1.vue
<template>
<div>
<h1 class="title">Page 1</h1>
<div class="links">
<nuxt-link to="page1">Page 1</nuxt-link>
<nuxt-link to="page2">Page 2</nuxt-link>
</div>
</div>
</template>
<script>
export default {
head() {
return {
title: 'Page 1',
};
},
}
</script>
// pages/page2.vue
<template>
<div>
<h1 class="title">Page 2</h1>
<div class="links">
<nuxt-link to="page1">Page 1</nuxt-link>
<nuxt-link to="page2">Page 2</nuxt-link>
</div>
</div>
</template>
<script>
export default {
head() {
return {
title: 'Page 2',
};
},
}
</script> // nuxt.config.js
export default {
head() {
return {
afterNavigation(metaInfo) {
console.log(metaInfo.title)
}
}
}
} |
Hmm, could you try to add the following in your nuxt.conf: vueMeta: { refreshOnceOnNavigation: true } and validate the option has changed by running |
Its same with attribute: "data-n-head"
contentKeyName: "content"
debounceWait: 10
keyName: "head"
metaTemplateKeyName: "template"
refreshOnceOnNavigation: true
ssrAppId: "ssr"
ssrAttribute: "data-n-head-ssr"
tagIDKeyName: "hid"
waitOnDestroyed: true |
Hmm, it seems that in Nuxt the vue-router afterEach guard is called before the new page component is fully mounted. Probably related to transitions, I can only fix it with |
Yeap...its works if add |
I'm really interested in this issue as I'm facing something similar; ie- meta title not being in sync w/ actual page reporting in analytics. The catch is I'm not using Nuxt but a CLI 3 SSR build. Vue-meta has worked great for the most part (been using a while) but this bug has thrown me for a bit of a loop—I've tried the referenced code on master branch w/o success; my 'off-by-one' page titles persist :( So I'm now wondering what |
@jeissler Did you set The |
@pimlie Thanks very much; I'm not sure why I hadn't tried that alone before going thru other possible causes/solutions... This may have just fixed the worst of the issues I'm experiencing w/ analytics; I'll keep checking and report back. Many thanks! |
@pimlie I have the exact same issue than @jeissler (trying to report to GA but always got previous page title) but I'm using Nuxt (universal mode, every standard setup). I tried to set I can't find any docs about |
Features is still considered experimental though, but should work for transitions. // nuxt.config.js
export default {
features: {
transitions: false
},
vueMeta: {
refreshOnceOnNavigation: true
}
} |
Setup two pages with Nuxt.js:
Expected behavior:
Page 1 will track "Page 1" as title
Page 2 will track "Page 2" as title
Actual behavior:
Page 1 & Page 2 tracks title correctly during initial load
Page 2 tracks "Page 1" when changing route from Page 1 -> Page 2
Page 1 tracks "Page 2" when changing route from Page 2 -> Page 1
The text was updated successfully, but these errors were encountered: