-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(vue-router): upgrade to vue-router 5 #31117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: major-9.0
Are you sure you want to change the base?
Changes from all commits
7283821
f32b10f
474100b
573370f
cae877b
c5113e9
e1dd044
3f69ec4
9f89730
9dc915a
f898584
2d0023d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ This is a comprehensive list of the breaking changes introduced in the major ver | |
| - [Router Outlet](#version-9x-router-outlet) | ||
| - [Framework Specific](#version-9x-framework-specific) | ||
| - [React](#version-9x-react) | ||
| - [Vue](#version-9x-vue) | ||
|
|
||
| <h2 id="version-9x-browser-platform-support">Browser and Platform Support</h2> | ||
|
|
||
|
|
@@ -251,3 +252,53 @@ The `IonRoute` component follows the same API changes as React Router's `<Route> | |
| ``` | ||
|
|
||
| For more information on migrating from React Router v5 to v6, refer to the [React Router v6 Upgrade Guide](https://reactrouter.com/6.28.0/upgrading/v5). | ||
|
|
||
| <h4 id="version-9x-vue">Vue</h4> | ||
|
|
||
| The `@ionic/vue-router` package now requires Vue Router v5. Vue Router v4 is no longer supported. Vue Router v5 also raises its peer requirement on Vue itself, so the minimum supported Vue version moves to `3.5.0`. | ||
|
|
||
| **Minimum Version Requirements** | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also open a PR to update this on the docs site: https://ionicframework.com/docs/reference/support#ionic-vue Side note: we should probably add columns for the supported router version as well.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant add it to the support table here: https://github.com/ionic-team/ionic-docs/blob/1c612e718a370241cdb92ef0f1a0bc6e2e1480fa/docs/reference/support.md?plain=1#L75-L82 |
||
| | Package | Supported Version | | ||
| | ---------- | ----------------- | | ||
| | vue-router | 5.0.0+ | | ||
| | vue | 3.5.0+ | | ||
|
|
||
| **Migration** | ||
|
|
||
| Vue Router 5 is a transition release that ships no runtime breaking changes for Vue Router 4 consumers, so no application code changes are required for routes, navigation guards, or the `IonRouterOutlet`. Bump the dep ranges in your app's `package.json`: | ||
|
|
||
| ```diff | ||
| "dependencies": { | ||
| - "vue": "^3.4.0", | ||
| - "vue-router": "^4.0.0" | ||
| + "vue": "^3.5.0", | ||
| + "vue-router": "^5.0.0" | ||
| } | ||
| ``` | ||
|
|
||
| **Deprecation Warning for `next()` in Navigation Guards** | ||
|
|
||
| Vue Router 5 prints a deprecation warning when `next()` is called inside `beforeRouteLeave`, `beforeRouteEnter`, `beforeRouteUpdate`, or `router.beforeEach`. The callback form still works, but Vue Router 6 will remove it. Migrate to the return-value pattern: | ||
|
|
||
| ```diff | ||
| // Composition API | ||
| onBeforeRouteLeave((to, from) => { | ||
| - if (!confirm('Leave?')) return next(false); | ||
| - next(); | ||
| + if (!confirm('Leave?')) return false; | ||
| + return true; | ||
| }); | ||
| ``` | ||
|
|
||
| ```diff | ||
| // Options API | ||
| beforeRouteLeave(to, from, next) { | ||
| - if (!confirm('Leave?')) return next(false); | ||
| - next(); | ||
| + beforeRouteLeave(to, from) { | ||
| + if (!confirm('Leave?')) return false; | ||
| + return true; | ||
| } | ||
| ``` | ||
|
|
||
| For more information on Vue Router 5, refer to the [Vue Router v4-to-v5 migration guide](https://router.vuejs.org/guide/migration/v4-to-v5.html). | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Chromium? The Angular tests don't pass in a browser.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Angular tests actually still only run Chromium despite downloading all 3 browsers. Both the vue tests and react tests only download the browser they use. It could be worth maybe adding support for running all 3 browsers in the future, but I think most of those issues are caught in core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, can you either make a new PR or in this one to update the other frameworks to only use chromium. No need to inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f898584