Ionic-framework: ion-back-button does not clean window.history

Created on 11 Mar 2019  路  3Comments  路  Source: ionic-team/ionic-framework

Bug Report

Ionic version:


[x] 4.4.0 Beryllium

Current behavior:

When going back with the ion-back-button, the page is not being removed from the window.history. Example:

// First page (without back button)
window.history
History聽{length: 1, scrollRestoration: "auto", state: {鈥}

// After navigating to page with back button
window.history
History聽{length: 2, scrollRestoration: "auto", state: {鈥}

// After clicking on back button
window.history
History聽{length: 3, scrollRestoration: "auto", state: {鈥}

Expected behavior:

After clicking the ion-back-button, we should remove that page from window.history. This should behave exactly the same as this.ionNavCtrl.back(), which seems to work as expected. Also, if it is not possible to go back and the ion-back-button uses the defaultBackLink property, then it should replace the current page with the one specified by the defaultBackLink property so we don't keep that in window.history.

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.11.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 7.0.1
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (/Users/mau/Library/Android/sdk)
   ios-deploy        : 1.9.2
   ios-sim           : 6.1.2
   NodeJS            : v8.11.3 (/usr/local/bin/node)
   npm               : 6.9.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001
triage

Most helpful comment

Related to #15428 and #15181.

All 3 comments

Related to #15428 and #15181.

Possibly related to #17445 ?

I've updated my Ionic version from 4.1.1 to 4.4.0 and the problem remains. The description of this issue has been updated accordingly.

Was this page helpful?
0 / 5 - 0 ratings