Open danielzen opened 4 years ago
Thanks for the issue! This issue has been labeled as needs reproduction
. This label is added to issues that need a code reproduction.
Please provide a reproduction with the minimum amount of code required to reproduce the issue. Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.
For a guide on how to create a good reproduction, see our Contributing Guide.
@liamdebeasi Here is an example that clearly shows the above bug:
Thanks, I can reproduce the issue. The issue is that when using IonRouterOutlet.pop
, we pop an item off the stack and navigate to the url stored in that item. Doing location.replaceState
does not update the url stored in that view item.
I just encountered this issue too, it also affects the iOS swipe back gesture. Did you find a solution @liamdebeasi?
I am encountering the same issue too.
try this.navCtrl.navigateRoot("update path", { replaceUrl: true });
instead of replaceState
.
Bug Report
Ionic version: [x] 5.x
Current behavior: I am doing a replace.State on the queryParams depending on which ionSlide is selected. In the template:
in PageComponent:
Later I
routerLink
to another page and useion-back-button
to return to this page, andion-back-button
is ignoring any and allreplaceState
s when updating the url. The state of the displayed url reverts to that before any and allreplaceState
calls. Onlyion-back-button
has this problem, using Angular'sLocation.back()
works as expected as does Ionic'sNavController.navigateBack()
. Even the browser's back button will restore thereplaceState
value (albeit with a reload).Looking through the code at
IonBackButtonDelegate
, I can see the underlying code relies on our culprit:IonRouterOutlet.pop()
This is similar to (but different than) #15181
Expected behavior: The
ion-back-button
should do the same as the browser's back button, and return to the URL contents to the lastlocation.replaceState
Steps to reproduce:
Ionic info: