From 205e42cbdbe5681f13c65aebcf23bd277f0db787 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Sun, 10 Nov 2024 16:21:36 +0800 Subject: [PATCH] fix: prevent view-transition in the same slide --- packages/client/composables/useViewTransition.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/client/composables/useViewTransition.ts b/packages/client/composables/useViewTransition.ts index a5341b354e..d7eea924ee 100644 --- a/packages/client/composables/useViewTransition.ts +++ b/packages/client/composables/useViewTransition.ts @@ -17,7 +17,7 @@ export function useViewTransition() { const toMeta = getSlide(to.params.no as string)?.meta const fromNo = fromMeta?.slide?.no const toNo = toMeta?.slide?.no - const transitionType = fromNo != null && toNo != null + const transitionType = fromNo != null && toNo != null && fromNo !== toNo && ((fromNo < toNo ? fromMeta?.transition : toMeta?.transition) ?? configs.transition) if (transitionType !== 'view-transition') { isViewTransition.value = false @@ -41,7 +41,6 @@ export function useViewTransition() { // Wait for `TransitionGroup` to become normal `div` setTimeout(() => { - // @ts-expect-error missing types document.startViewTransition(() => { changeRoute() return promise