From c5a0267c33b14fef133dfd1a9c18dc2a333a032c Mon Sep 17 00:00:00 2001 From: alexpts Date: Sat, 8 Jan 2022 17:34:47 +0300 Subject: [PATCH] Don`t commit to vuex for failure transition --- src/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d6d7ff2..1f046b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,11 +53,16 @@ export function sync( ) // sync store on router navigation - const afterEachUnHook = router.afterEach((to, from) => { + const afterEachUnHook = router.afterEach((to, from, failure) => { if (isTimeTraveling) { isTimeTraveling = false return } + + if (failure) { + return; + } + currentPath = to.fullPath store.commit(moduleName + '/ROUTE_CHANGED', { to, from }) })