bug: (vue) Switching between tabs with a query string messes up route
See original GitHub issuePrequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
Current Behavior
I have a url with a custom query param, i.e.: http://localhost:8080/meer?domain=dCWh5t1dnF.pwa.autosociaal.nl
, which is the “meer” tab. When I go to the “start” tab the url changes to http://localhost:8080/start?domain=dCWh5t1dnF.pwa.autosociaal.nl
. When I click the “meer” tab again it again changes back to http://localhost:8080/meer?domain=dCWh5t1dnF.pwa.autosociaal.nl
. Now, when I click the start tab again it suddenly becomes: http://localhost:8080/startdomain=dCWh5t1dnF.pwa.autosociaal.nl?domain=dCWh5t1dnF.pwa.autosociaal.nl
I have this router lifecycle hook in place to make it happen:
router.beforeEach(async (to, from, next) => {
if (from.query.domain && !to.query.domain) {
next({ ...to, query: from.query });
return;
}
next();
});
Expected Behavior
The pathname should just be start
or meer
, not startdomain
Steps to Reproduce
Create a tabs setup with this router lifecycle hook:
router.beforeEach(async (to, from, next) => {
if (from.query.domain && !to.query.domain) {
next({ ...to, query: from.query });
return;
}
next();
});
In this app it is also reproducable: https://7cu0jmqxdb.appflowapp.com/tabs/tab1?domain=dCWh5t1dnF.pwa.autosociaal.nl - start clicking between the tabs and see the route pathname of tab1 change between the clicking to tab1domain
Code Reproduction URL
https://7cu0jmqxdb.appflowapp.com/tabs/tab1?domain=dCWh5t1dnF.pwa.autosociaal.nl
Ionic Info
Ionic:
Ionic CLI : 6.16.3 (/Users/bob/.config/yarn/global/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 5.6.12
Utility:
cordova-res : not installed globally
native-run : 1.4.0
System:
NodeJS : v14.17.3 (/Users/bob/.nvm/versions/node/v14.17.3/bin/node)
npm : 6.14.13
OS : macOS Big Sur
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top GitHub Comments
Can you try the following dev build and let me know if it fixes the issue?
@liamdebeasi Works!
I just tested the dev build in the reproduction project as well as our actual project.
Thank you very much for your effort, I really appreciate it!