Skip to content

bug: react, vue back button does not select correct view when going back from a tabs instance #23101

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

Closed
horganice opened this issue Mar 25, 2021 · 9 comments · Fixed by #23154
Labels
package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report
Milestone

Comments

@horganice
Copy link

horganice commented Mar 25, 2021

Bug Report

Ionic version:

[ ] 4.x
[x] 5.6.3 (Latest)

Current behavior:
I have an ionic-vue app that uses vue-router and the tabs template.
When I navigate to a nest tabs, and switch to tab2 and switch back to tab1.
When I click on ion-back-button it show error Cannot read property 'ionPageElement' of undefined

Expected behavior:
I would expect that switch back to parent tabs

Steps to reproduce:
Make a ionic-vue app using the tabs template
Add a sub route to one of the tabs (i.e. tab1) (make sure this view has the ion-back-button active in the ion-toolbar)
Enter the sub route (of tab1)
Switch to another tab (i.e. tab2) from this sub route
Switch back to the tab that has the sub route active (i.e. tab1)
Press the back button in this sub route
The back button causes the view to return to the parent view of this tab (tab1 in this case, which I would expect) but the url switches back to the other tab (tab2)

  • Make a ionic-vue app using the tabs template
  • Create tabs2 (/tabs2/test) and add ion-back-button
  • Navigate to tabs2/test/tab1
  • Switch to tab2
  • Switch back to tab1
  • Click ion-back-button
  • It show error Cannot read property 'ionPageElement' of undefined

GIF Image ( Steps to reproduce )

Related code:
https://codesandbox.io/s/magical-snow-w7xok

Other information:

Ionic info:

Ionic:

   Ionic CLI       : 6.13.1
   Ionic Framework : @ionic/vue 5.6.3

Capacitor:

   Capacitor CLI   : 2.4.7
   @capacitor/core : 2.4.7

Utility:

   cordova-res : 0.15.3
   native-run  : 1.3.0

System:

   NodeJS : v14.15.5
   npm    : 6.14.11
   OS     : macOS Big Sur
@ionitron-bot ionitron-bot bot added the triage label Mar 25, 2021
@horganice horganice changed the title bug: bug: Cannot read property 'ionPageElement' of undefined Mar 25, 2021
@scryptoking
Copy link

Maybe related to my issue #23087

@scryptoking
Copy link

Took another look at this. I think this has something to do with putting a ion-header (with ion-back-button) outside of the tabs. I find this uncommon use (I think). But I could be mistaken. @liamdebeasi When routing through this codesandbox, the url gives the same issue as in #23087.

@liamdebeasi
Copy link
Contributor

Thanks, I will take a closer look at this. I need to see if using ion-back-button outside of tabs to control the tabs is something we support.

@liamdebeasi
Copy link
Contributor

I can confirm this is a bug in both Ionic Vue and Ionic React. I will look into a fix.

@liamdebeasi liamdebeasi added package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report labels Apr 2, 2021
@ionitron-bot ionitron-bot bot removed triage labels Apr 2, 2021
@liamdebeasi liamdebeasi changed the title bug: Cannot read property 'ionPageElement' of undefined bug: react, vue back button does not select correct view when going back from a tabs instance Apr 2, 2021
@liamdebeasi liamdebeasi added this to the 5.7.0 milestone Apr 2, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. Can you try the following dev build and let me know if it resolves the issue?

npm install @ionic/vue@5.7.0-dev.202104021913.b0533ff @ionic/vue-router@5.7.0-dev.202104021913.b0533ff

@Suxsem
Copy link

Suxsem commented Apr 4, 2021

dear @liamdebeasi I tried your dev built but I'm encountering the issue described here: #23141
can you please take a look?

@horganice
Copy link
Author

@liamdebeasi Just did a dev build on my project. all is working fine now :) Thank you !

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23154, and a fix will be available in an upcoming release of Ionic Framework.

@ionitron-bot
Copy link

ionitron-bot bot commented May 6, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants