mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
fix(vue): ensure view is updated correctly when replacing a route outside of a nav guard (#22429)
resolves #22412
This commit is contained in:
@ -29,7 +29,15 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
||||
*/
|
||||
router.afterEach((to: RouteLocationNormalized, _: RouteLocationNormalized) => {
|
||||
const { direction, action } = currentNavigationInfo;
|
||||
handleHistoryChange(to, action, direction);
|
||||
|
||||
/**
|
||||
* When calling router.replace, we are not informed
|
||||
* about the replace action in opts.history.listen
|
||||
* but we can check to see if the latest routing action
|
||||
* was a replace action by looking at the history state.
|
||||
*/
|
||||
const replaceAction = history.state.replaced ? 'replace' : undefined;
|
||||
handleHistoryChange(to, action || replaceAction, direction);
|
||||
|
||||
currentNavigationInfo = { direction: undefined, action: undefined };
|
||||
});
|
||||
|
Reference in New Issue
Block a user