const href = computed(() => router.createHref(route.value))
const activeRecordIndex = computed<number>(() => {
+ // TODO: handle children with empty path: they should relate to their parent
const currentMatched = route.value.matched[route.value.matched.length - 1]
return router.currentRoute.value.matched.findIndex(
isSameRouteRecord.bind(null, currentMatched)
for (const guard of record.leaveGuards) {
guards.push(guardToPromiseFn(guard, to, from))
}
-
- // free the references
- record.instances = {}
}
// run the queue of per route beforeRouteLeave guards
// run the queue of per route beforeEnter guards
await runGuardQueue(guards)
+
+ // TODO: add tests
+ // this should be done only if the navigation succeeds
+ // if we redirect, it shouldn't be done because we don't know
+ for (const record of leavingRecords) {
+ // free the references
+ record.instances = {}
+ }
}
/**