question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: ionic/vue router issue with tabs: after second route change in a tab, cannot move outside of the tab route anymore

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

Given a project with the following routing structure:


/start 
/tabs/:id (children below)
  /tab1
  /tab1/view1
  /tab1/view2

When navigating as follows: (1) /start -> (2) /tabs/test/tab1 -> (3) /tabs/test/tab1/view1 -> (4) /tabs/test/tab1/view2 -> (4) /start on the last navigation step to (4)/start, the route is changed in the browser, but the app does not show the correct content, i.e. does not render.

Expected Behavior

after step (4) render content for /start route.

Steps to Reproduce

Full minimal example here: https://github.com/CarstenRuetz/IonicRoutingIssue

Code Reproduction URL

https://github.com/CarstenRuetz/IonicRoutingIssue

Ionic Info

[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module ‘@capacitor/ios/package’

   Require stack:
   - /usr/local/lib/node_modules/@ionic/cli/lib/project/index.js
   - /usr/local/lib/node_modules/@ionic/cli/lib/index.js
   - /usr/local/lib/node_modules/@ionic/cli/index.js
   - /usr/local/lib/node_modules/@ionic/cli/bin/ionic

[WARN] Error loading @capacitor/android package.json: Error: Cannot find module ‘@capacitor/android/package’

   Require stack:
   - /usr/local/lib/node_modules/@ionic/cli/lib/project/index.js
   - /usr/local/lib/node_modules/@ionic/cli/lib/index.js
   - /usr/local/lib/node_modules/@ionic/cli/index.js
   - /usr/local/lib/node_modules/@ionic/cli/bin/ionic

Ionic:

Ionic CLI : 6.20.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/vue 6.3.7

Capacitor:

Capacitor CLI : 4.5.0 @capacitor/android : not installed @capacitor/core : 4.5.0 @capacitor/ios : not installed

Utility:

cordova-res : not installed globally native-run : 1.7.1

System:

NodeJS : v16.17.1 (/usr/bin/node) npm : 8.15.0 OS : Linux 5.15

Additional Information

Additional information

  • there is no message in the javascript console
  • taking out any single one of the navigation steps 1-4 before moving back to /start does not show any problem: correct content is rendered
  • taking out the variable :id in the route, i.e. just creating a fixed route like /tabs/XX/ makes the issue disappear
  • moving the :id in front of the child routes like :id/tab1, :id/tab1/view1 makes the issue disappear (but that creates a new problem: in the Tab Component, the :id variable cannot be read from the route using useRoute() because that function can only be used in setup() which has already been called before navigating to an individual child route. Hence the :id variable is not accessible at the right time).
  • switching from router-links to code navigation with ionRouter.push/navigate/… makes no difference
  • browsers history seems to be set correctly on each step

Debug results so far: The issue only appears with a parent route that contains a variable and in a navigation series that contains two moves within the children routes.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Nov 21, 2022

Thanks for the report. Did you push your changes? I only see the Ionic tabs starter application.

0reactions
CarstenRuetzcommented, Nov 28, 2022

solved with workaround

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues navigating to different routes when using tabs in Ionic ...
I'm trying to add a new route/component for the Login screen. I want the login screen to be outside of the tab system...
Read more >
Ionic nested routes and tabs not working as expected
Hi, We have an application with 4 tabs each having nested routes. ... doesn't belong to any tab, and clicking ion-back-button work fine...
Read more >
Framework7 Release Notes
New currentPageEl router property that points to current page HTMLElement. Improved routable tabs support for different routes but with same tab IDs; Improved ......
Read more >
@ionic/core | Yarn - Package Manager
Ionic is an open source app development toolkit for building modern, fast, top-quality cross-platform native and Progressive Web Apps from a single codebase ......
Read more >
IntelliJ IDEA 183.3975.8 Beta Release Notes | Knowledge Base
Feature IDEA‑132487 External annotations for java third party libraries Feature IDEA‑196706 Multithread model for new SE Feature IDEA‑127245 Open all files from favorites list Bug IDEA‑113988...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found