-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: tabs do not work correctly when using pages outside tab routes #27847
Comments
Thanks for the issue! This issue has been labeled as Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed. If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue. For a guide on how to create a good reproduction, see our Contributing Guide. |
I have added (in the initial report) a link to a reproduction repo: darrylnoakes/ionic-27847. I have left in almost the full route structure, to allow for testing of all the different flows I stated. |
I have added a screen recording. |
Also: Navigating to a nested view in a tab, switching tabs, navigating to an "external" view, and going back clears the state of the first tab. In this case:
The playlist tab shows the playlist index instead of the playlist viewer. |
Currently, the only options I can see for now are as follows: Don't use tabs, and figure out an alternative UI. Present everything else in modals. |
Can you check your reproduction? I am getting a |
I did a fresh clone and ran It also worked fine for me when opening the repo in StackBlitz Codeflow. |
This comment was marked as outdated.
This comment was marked as outdated.
I can reproduce this issue after using This looks to be another instance of #25213, so I am going to merge the two threads. |
Hmm. So, basically, you can't really used child views in tabs with Vue (#25213)? And tabs seem to have other issues (#24594). Does that issue also account for the behavior with tab-external routes and page lifecycle events? Or is a route structure with routes external to tabs not actually supported? E.g., if I changed the child view to a modal, would the issue with lifecycle events persist? |
This issue is unique to tabs with child routes, so using a modal as a child view within a tab should be fine. |
For anyone who's interested: I have settled for making the playlist viewer also external to the tabs.
to
This means that it overlays the tabs router view (and you therefore cannot easily switch between viewing the song index and viewing a playlist), but I'll settle for that over having to implement something complicated. |
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. |
Prerequisites
Ionic Framework Version
v6.x
Current Behavior
I am using Vue and Ionic 6.7.5.
Tabs do not work correctly when using pages outside tab routes.
This is the relevant route config:
The structure is:
The playlists page has a list of playlists which can be viewed using the shared-route view. This view has a list of songs that can be pushed to. The song-viewing view is external to the tabs.
Page lifecycle events
The app starts on the index page. Navigating to the playlists page, a playlist, a song, and back (any method) does not trigger the playlist-viewing page's view entering event.
Index -> Playlists -> Playlist [nested] -> Song [external to tabs] -> (back) Playlist
The paths are:
/index
/playlists
/playlists/xxx
/song/yyy
/playlists/xxx
After leaving the nested view (going back to the root view of the playlist tab), it works fine. Switching to the other tab and back also fixes it.
Leaving the nested view and coming back -- before doing anything else -- prevents the issue.
Starting on the playlists tab does not manifest the issue; however, going to the index tab sets the stage for it.
A complex orchestration of history state.
A button that navigates to the settings page is present on all the pages. This exhibits the same behavior when using it from the nested view.
The behavior does not appear to manifest when navigating to and from the external views directly from the root tab views; only from the nested view in the playlist tab.
Also, view leaving events are never triggered when navigating to a view external to tabs.
Tab navigation state
Navigating to a nested view in a tab, switching tabs, navigating to an "external" view, and going back clears the state of the first tab.
In this case:
The playlist tab shows the playlist index instead of the playlist viewer.
Expected Behavior
I expect to be able to use pages external to the tab routes.
Specifically:
Steps to Reproduce
Create a tabbed Vue application with the route structure like the one described above. Include logging of the page lifecycle events.
Load the app on the index page. Navigate to the playlists page, a playlist, a song, and back (any method).
Index -> Playlists -> Playlist [nested] -> Song [external to tabs] -> (back) Playlist
The paths are:
/index
/playlists
/playlists/xxx
/song/yyy
/playlists/xxx
Code Reproduction URL
darrylnoakes/ionic-27847
Ionic Info
Actually Windows 11.
Additional Information
Is this the correct behavior or a bug? Is it a known or unknown issue?
I do not know if this is an issue in Ionic 7.
Related issues:
Possibly related:
Video of reproducing the lifecycle events issue:
Repro.mp4
The text was updated successfully, but these errors were encountered: