question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Title gets undefined during page transitions

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v18.12.1
  • Nuxt Version: 3.0.0-rc.13
  • Nitro Version: 0.6.1
  • Package Manager: npm@8.19.3
  • Builder: vite
  • User Config: nitro, runtimeConfig, modules, alias, schemaOrg, image, colorMode, pwa
  • Runtime Modules: @nuxtjs/tailwindcss@6.1.3, @kevinmarrec/nuxt-pwa@0.10.0, @nuxt/image-edge@1.0.0-27769790.4b27db3, @nuxtjs/color-mode@3.1.8, @pinia/nuxt@0.4.3, nuxt-schema-org@1.1.0-beta.5
  • Build Modules: -

Reproduction

Minimal reproduction in the Stackblitz repository

The repository of the website in production

Describe the bug

Title gets undefined when transitioning between pages.

in app.vue:

<script setup>
useHead({
  titleTemplate: (title) => `${title} | Title Site`,
});
</script>

in my pages :

<script setup>
useHead({
  title: 'Title of the Page',
});
</script>

Note : I am using JS transition hooks with vue syntax (see Vue documentation) because of this upstream bug with Suspense (used by NuxtPage) #5844

Additional context

Following the previous issue #6183

Logs

No response

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
danielroecommented, Nov 7, 2022

You need to use <NuxtPage> for the title to be properly suspended during route transition: see https://stackblitz.com/edit/nuxt-starter-hohjgt.

I believe your issue would also be reproduced in a pure vue project but have not yet had time to confirm. You can try at https://stackblitz.com/github/nuxt-contrib/vue3-ssr-starter/tree/main.

0reactions
BenjaminOddoucommented, Nov 14, 2022

I think that there is no possibility to enable JS transitions globally with <NuxtPage> for now @danielroe 🤔. The different hooks (onEnter, onLeave…) are not triggered when changing page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript page transition undefined - jquery - Stack Overflow
Notice that I am passing a function as the second argument to the .fadeIn function. (See the API Docs.) You cannot just pass...
Read more >
Smooth and simple transitions with the View Transitions API
The View Transition API makes it easy to change the DOM in a single step, while creating an animated transition between the two...
Read more >
Issue with latest elementor | WordPress.org
Hi, with the latest elementor update, I'm not able to edit pages in elementor directly. When deactivating your plugin everythings works.
Read more >
jQuery.mobile.changePage()
Decides what direction the transition will run when showing the page. role (default: undefined ). Type: String. The data-role value to be used...
Read more >
Building single-page applications with CSS transitions
Using CSS page transitions, build a single-page application that ... But if we add a route that is not in the array, we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found