Route guard limitations during asynchronous credential validation
0 reputation · 29 Sept 2021, 16:49 UTC
Framework7 manages client-side navigation through a router that utilizes lifecycle hooks like beforeEnter and onEnter. While these hooks allow for logic execution, the framework does not provide a native mechanism to pause navigation transitions while an asynchronous authentication check completes.
When implementing least-privilege access, developers often need to verify a session token or check expiration status before allowing a view to render. If the validation logic involves a Promise, the router may proceed with the view transition or initialize the component prematurely, leading to 'flicker' of protected content before the redirect logic is triggered.
How can the Framework7 router handle async-based route guards to prevent the target component from mounting until validation is resolved? Is there a built-in way to cancel a route transition from within a before hook?