Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavController.remove() doesnt work as expected. #8442

Closed
NoNameProvided opened this issue Oct 3, 2016 · 16 comments
Closed

NavController.remove() doesnt work as expected. #8442

NoNameProvided opened this issue Oct 3, 2016 · 16 comments
Assignees

Comments

@NoNameProvided
Copy link
Contributor

NoNameProvided commented Oct 3, 2016

Short description of the problem:

The NavController.remove function doesnt work as docs states. It cant remove pages in some cases when it should be able to.

What behavior are you expecting?

NavController.remove works as docs states and remove pages from the stack the correct way.

Steps to reproduce:

For testing you will have to expose the NavController in the last page with console.log. (In the constructor add console.log(this.nav));

We will use this code snippet to list the stack, because no built in options exist for it now at the moment.

[
(temp1.getByIndex(0))?temp1.getByIndex(0).instance:null,
(temp1.getByIndex(1))?temp1.getByIndex(1).instance:null,
(temp1.getByIndex(2))?temp1.getByIndex(2).instance:null,
(temp1.getByIndex(3))?temp1.getByIndex(3).instance:null,
(temp1.getByIndex(4))?temp1.getByIndex(4).instance:null,
(temp1.getByIndex(5))?temp1.getByIndex(5).instance:null,
]
  1. Push 5 pages to the stack. (The fifth element in the above snipets, confirms our stack is 5 element long.)
  2. In the last page run the code snippet above to check the stack
  3. Run the following code in the console: temp1.remove(temp1.length() - 2, 2)
  4. Check the stack with the snippet above, and notice that only the last element was removed from the stack not the last 2.

Note: This seems not to work only if I try to remove the last 2 page. With the last 1 or 3 it works well. So temp1.remove(temp1.length() - 1, 1) and temp1.remove(temp1.length() - 2, 2) produces the same result.

Which Ionic Version? 2.x

Run ionic info from terminal/cmd prompt: (paste output below)

Cordova CLI: 6.3.1
Gulp version:  CLI version 1.2.2
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: Mac OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 8.0 Build version 8A218a 
@jgw96 jgw96 added the v2 label Oct 4, 2016
@manucorporat manucorporat self-assigned this Oct 4, 2016
@rodriguesgm
Copy link
Contributor

same problem for me here.
I have this code that worked on Beta11 but in RC0 it's not working anymore.

this.nav.push(MyNextPage, params).then(() => { this.nav.remove(this.nav.getActive().index - 1, 1); });

I tried to remove the nav.remove from inside the promise but it didn't work either

@NoNameProvided
Copy link
Contributor Author

Do we have any official hint how to handle this in the meantime?

Our navigation is heavily based on this function. We have pretty hard time figuring out how to solve this efficiently without making big modifications to our current navigation.

@mlynch
Copy link
Contributor

mlynch commented Oct 9, 2016

@rodriguesgm can you explain the effect you are going for there? You want to push a new page and then once that's pushed, remove the page you just came from?

I just tested this and the case of removing 1 works for me, digging deeper.

@mlynch
Copy link
Contributor

mlynch commented Oct 9, 2016

Weird, this does appear to only break for me once the stack is >= 5. Anyone have a test project to share? I'm not seeing any issues when stack < 5.

@mlynch
Copy link
Contributor

mlynch commented Oct 9, 2016

I found the issue, fixing

@mlynch mlynch closed this as completed in 6496c7a Oct 9, 2016
@mlynch
Copy link
Contributor

mlynch commented Oct 9, 2016

Thanks for the info everyone, this is fixed and will be in the next release.

@jourdan-jobox
Copy link

Hi @mlynch, thanks for the fix! Been trying to debug this for a couple hours, glad to see this issue has been resolved.

Would love for it to be released very soon however :) :) :)

@numerized
Copy link

There's a regression on this ?

I have still this issue

@ThalesMatoso
Copy link

There's a regression on this ?

I have still this issue

this.navCtrl.remove not work

1 similar comment
@renanmoraes
Copy link

There's a regression on this ?

I have still this issue

this.navCtrl.remove not work

@manuvalentim
Copy link

I have the same problem.

this.navCtrl.remove not work

@NoNameProvided
Copy link
Contributor Author

NoNameProvided commented Jul 6, 2017

If you provide some step you did to debug the problem, and cc a team member, maybe it will be checked sooner. At least test in which version of ionic the regression happened.

(We dont need this right now, so I have no time to check this now.)

@renanmoraes
Copy link

renanmoraes commented Jul 6, 2017

Problem solved #12238

@supryin
Copy link

supryin commented Aug 6, 2017

I am still facing this issue. Ionic-angular 3.5.3.
isTransitioning is still true after remove

@numerized
Copy link

me too.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests