Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt): check if global transitions are activated for scroll behavior #8700

Merged
merged 3 commits into from Nov 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/nuxt/src/pages/runtime/router.options.ts
Expand Up @@ -2,6 +2,7 @@ import type { RouterConfig } from '@nuxt/schema'
import type { RouterScrollBehavior, RouteLocationNormalized } from 'vue-router'
import { nextTick } from 'vue'
import { useNuxtApp } from '#app'
import { appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'

type ScrollPosition = Awaited<ReturnType<RouterScrollBehavior>>

Expand Down Expand Up @@ -31,7 +32,7 @@ export default <RouterConfig> {
}

// Wait for `page:transition:finish` or `page:finish` depending on if transitions are enabled or not
const hasTransition = to.meta.pageTransition !== false && from.meta.pageTransition !== false
const hasTransition = defaultPageTransition || (to.meta.pageTransition && from.meta.pageTransition)
Atinux marked this conversation as resolved.
Show resolved Hide resolved
const hookToWait = hasTransition ? 'page:transition:finish' : 'page:finish'
return new Promise((resolve) => {
nuxtApp.hooks.hookOnce(hookToWait, async () => {
Expand Down