mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
fix(vue): use correct history mode when doing ssr to avoid errors (#23255)
resolves #23254
This commit is contained in:

committed by
GitHub

parent
d94739f39b
commit
2e00dab95d
@ -39,8 +39,10 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) =>
|
|||||||
* about the replace action in opts.history.listen
|
* about the replace action in opts.history.listen
|
||||||
* but we can check to see if the latest routing action
|
* but we can check to see if the latest routing action
|
||||||
* was a replace action by looking at the history state.
|
* was a replace action by looking at the history state.
|
||||||
|
* We need to use opts.history rather than window.history
|
||||||
|
* because window.history will be undefined when using SSR.
|
||||||
*/
|
*/
|
||||||
const replaceAction = history.state.replaced ? 'replace' : undefined;
|
const replaceAction = opts.history.state.replaced ? 'replace' : undefined;
|
||||||
handleHistoryChange(to, action || replaceAction, direction);
|
handleHistoryChange(to, action || replaceAction, direction);
|
||||||
|
|
||||||
currentNavigationInfo = { direction: undefined, action: undefined };
|
currentNavigationInfo = { direction: undefined, action: undefined };
|
||||||
|
Reference in New Issue
Block a user