-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Bug Report
Ionic version:
[x] 4.x
Current behavior:
routerLink stops working after navigating to and subsequently deactivating a named/secondary outlet route.
Expected behavior:
Router Links should continue to work even after the outlet/route they refer to has been navigated to and subsequently deactivated.
Steps to reproduce:
- Clone sample app, cd into folder, npm i, ionic serve...
- Open the application http://localhost:8100
- Click "Metagame" on the app menu
- Click "Works once"
- Click the (X) at the top of the detail outlet to close it (or click "Metagame in the menu again)
- Click "Works once" --- Nothing happens --- we should re-open the detail/secondary outlet here but it does not.
- Click "Works every time" -- the outlet opens like it should have. But we should not need to specify fully qualified URLs to routerLink, that's horrifyingly leaky and a maintenance nightmare
Now. In app.component.html, replace <ion-router-outlet main class="app-main"></ion-router-outlet>
with <router-outlet main class="app-main"></router-outlet>
Repeat steps 1-5: The outlet opens as expected.
This is a blocking bug in ion-router-outlet. The only workaround is to hardcode fully qualified router URLs in the entire application, rather than properly targeting named router outlets directly via their proper relative URL. which would immediately break everything as soon as a single route in the middle of the hierarchy is changed.
Related code:
https://github.com/TopDecked/ionic-router-outlet-bug
Other information:
This seems related to:
#16534
#18197
#18823
ionic-team/ionic-v3#713 (this should not have been moved to v3 repo...)
Ionic info:
Lincolns-MacBook-Pro-2:topdecked-named-router-bug lincoln$ ionic info
Ionic:
Ionic CLI : 5.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.6.2
@angular-devkit/build-angular : 0.800.3
@angular-devkit/schematics : 7.3.1
@angular/cli : 8.0.3
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 8.1.2 ([email protected])
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run : 0.2.7 (update available: 0.2.8)
System:
Android SDK Tools : 26.1.1 (/usr/local/share/android-sdk)
ios-deploy : 1.9.4
NodeJS : v12.3.1 (/usr/local/Cellar/node/12.3.1/bin/node)
npm : 6.10.1
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001