I'm encountering an unexpected behavior with Vue Router's beforeEach guard. Despite following the documented approach of returning to.fullPath to initiate a redirect, the navigation isn't occurring as anticipated. I've discovered that employing next within the guard is the sole method to successfully trigger a redirect.
Actual behavior
I'm encountering an inconsistency in Vue Router's beforeEach guard behavior. While utilizing the next method results in a successful second route match, returning to.fullPath doesn't trigger a subsequent guard execution. This discrepancy leads to an unrendered page.
Additional information
I'm encountering an issue with Vue Router's beforeEach guard. I'm expecting return to.fullPath to initiate a redirect, but the guard isn't being re-evaluated and the route doesn't match. Switching to next(to) resolves the issue. Could you please explain the underlying mechanism and why this behavior occurs?
vue-router version: 4.0.16
vue version: 3.2.45
I noticed the documentation recommends using return to.fullPath to trigger redirects, but this method doesn't seem to re-trigger the route guard. Is this unexpected behavior or is it by design?
Reproduction
production
Steps to reproduce the bug
Expected behavior
I'm encountering an unexpected behavior with Vue Router's beforeEach guard. Despite following the documented approach of returning to.fullPath to initiate a redirect, the navigation isn't occurring as anticipated. I've discovered that employing next within the guard is the sole method to successfully trigger a redirect.
Actual behavior
I'm encountering an inconsistency in Vue Router's beforeEach guard behavior. While utilizing the next method results in a successful second route match, returning to.fullPath doesn't trigger a subsequent guard execution. This discrepancy leads to an unrendered page.
Additional information
I'm encountering an issue with Vue Router's beforeEach guard. I'm expecting return to.fullPath to initiate a redirect, but the guard isn't being re-evaluated and the route doesn't match. Switching to next(to) resolves the issue. Could you please explain the underlying mechanism and why this behavior occurs? vue-router version: 4.0.16 vue version: 3.2.45