]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor(guards): use enteringRecords in queue (#1910)
authorlightnoway <lightnoway@qq.com>
Mon, 3 Jul 2023 06:40:38 +0000 (14:40 +0800)
committerGitHub <noreply@github.com>
Mon, 3 Jul 2023 06:40:38 +0000 (08:40 +0200)
packages/router/src/router.ts

index 9a8c469be39d9c22471db694a05a334f201e6734..f7ad75d0388bc4cefa8becd5dddf11528d198d6f 100644 (file)
@@ -855,9 +855,9 @@ export function createRouter(options: RouterOptions): Router {
         .then(() => {
           // check the route beforeEnter
           guards = []
-          for (const record of to.matched) {
+          for (const record of enteringRecords) {
             // do not trigger beforeEnter on reused views
-            if (record.beforeEnter && !from.matched.includes(record)) {
+            if (record.beforeEnter) {
               if (isArray(record.beforeEnter)) {
                 for (const beforeEnter of record.beforeEnter)
                   guards.push(guardToPromiseFn(beforeEnter, to, from))