feat: add ability for routing integrations to not cache views
See original GitHub issueBug Report
Ionic version:
[x] 4.x
Current behavior:
It looks like the back button does not show up in some cases when it should. This happens if one page gets opened a second time.
Possibly pages get initialized without ‘can-go-back’ and this does not get updated.
Wrong behavior:
My app opens a “list page” which can open a “detail page” which can open the “list page” with other query params again. This “list page” does not show an ionic-back-button
.
Expected behavior:
I would expect the ionic-back-button
to show on the last “list page” and take me back to the “detail page” and from there another ionic-back-button
to the first “list page”.
Steps to reproduce:
- Start app on home page
- Click on button on homepage at the bottom “LIST”
- Navigated to ListPage
- Click on “Item 1”
- Navigated to Homepage -> There is no back button
If I use the list page from menu, the back-button will show on the home page. But if I go to the list page again from there, the button will disappear as well.
Related code:
This is my test case.
Other information:
Ionic info:
New menu template
Ionic:
Ionic CLI : 5.4.1 (/Users/gedysintraware/.nvm/versions/node/v10.13.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.10.0
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
NodeJS : v10.13.0 (/Users/gedysintraware/.nvm/versions/node/v10.13.0/bin/node)
npm : 6.4.1
OS : macOS Mojave
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:12 (7 by maintainers)
Top GitHub Comments
same happens with React apps
Thanks for the issue. By default, all of our routing integrations will re-use existing views if they match the same URL. For example:
/a
-->/b
-->/a
would re-use the rendered view for/a
andion-back-button
would not appear since it is on the root view.While this is working as intended, I can understand that this may not be expected or desirable in some situations. Changing this would be a breaking change that we can look into, or we can look into making this an opt-in feature. Either way there is certainly going to need to be some discussion about how to implement this.
For anyone who is running into this scenario: Would you be able to provide a use case and a code sample that can help us understand how this behavior affects your applications? Thanks!