From 26898c6e261e84b99947a2810678a209dcf21ac4 Mon Sep 17 00:00:00 2001 From: julien huang Date: Wed, 30 Aug 2023 21:22:51 +0200 Subject: [PATCH] chore: improve condition --- packages/nuxt/src/pages/runtime/router.options.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/nuxt/src/pages/runtime/router.options.ts b/packages/nuxt/src/pages/runtime/router.options.ts index 565bdd18f4..0fe3f4de76 100644 --- a/packages/nuxt/src/pages/runtime/router.options.ts +++ b/packages/nuxt/src/pages/runtime/router.options.ts @@ -64,11 +64,5 @@ function _getHashElementScrollMarginTop (selector: string): number { function _isDifferentRoute (from: RouteLocationNormalized, to: RouteLocationNormalized): boolean { const isSamePath = to.path === from.path - - if (!isSamePath) { - return true - } else if (JSON.stringify(from.params) !== JSON.stringify(to.params)) { - return true - } - return false + return !isSamePath || JSON.stringify(from.params) !== JSON.stringify(to.params) }