mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(nuxt): don't show transition on initial page load (#24935)
This commit is contained in:
parent
4dd87f6e28
commit
160208009e
@ -4,6 +4,8 @@ import type { Component, RendererNode } from 'vue'
|
||||
import { isString, isPromise, isArray, isObject } from '@vue/shared'
|
||||
import destr from 'destr'
|
||||
import type { RouteLocationNormalized } from '#vue-router'
|
||||
// @ts-expect-error virtual file
|
||||
import { START_LOCATION } from '#build/pages'
|
||||
|
||||
/**
|
||||
* Internal utility
|
||||
@ -29,7 +31,7 @@ function generateRouteKey (route: RouteLocationNormalized) {
|
||||
* return true if the route has been changed with a page change during navigation
|
||||
*/
|
||||
export function isChangingPage (to: RouteLocationNormalized, from: RouteLocationNormalized) {
|
||||
if (to === from) { return false }
|
||||
if (to === from || from === START_LOCATION) { return false }
|
||||
|
||||
// If route keys are different then it will result in a rerender
|
||||
if (generateRouteKey(to) !== generateRouteKey(from)) { return true }
|
||||
|
@ -90,7 +90,10 @@ export default defineNuxtModule({
|
||||
addPlugin(resolve(distDir, 'app/plugins/router'))
|
||||
addTemplate({
|
||||
filename: 'pages.mjs',
|
||||
getContents: () => 'export { useRoute } from \'#app\''
|
||||
getContents: () => [
|
||||
'export { useRoute } from \'#app/composables/router\'',
|
||||
'export const START_LOCATION = Symbol(\'router:start-location\')'
|
||||
].join('\n')
|
||||
})
|
||||
addComponent({
|
||||
name: 'NuxtPage',
|
||||
@ -371,7 +374,7 @@ export default defineNuxtModule({
|
||||
// Add vue-router import for `<NuxtLayout>` integration
|
||||
addTemplate({
|
||||
filename: 'pages.mjs',
|
||||
getContents: () => 'export { useRoute } from \'vue-router\''
|
||||
getContents: () => 'export { START_LOCATION, useRoute } from \'vue-router\''
|
||||
})
|
||||
|
||||
// Optimize vue-router to ensure we share the same injection symbol
|
||||
|
Loading…
Reference in New Issue
Block a user