Skip to content

Quick Navigation Causes Screen Freeze #15413

Closed

Description

@kensodemann

Bug Report

Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.

^C~/Projects/Issues/Ionic-Nav-Repro (master *): ionic info 
✔ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)          : 4.1.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.7
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.7
   @ionic/schematics-angular  : 1.0.5

System:

   NodeJS : v9.8.0 (/usr/local/Cellar/node/9.8.0/bin/node)
   npm    : 6.4.0
   OS     : macOS High Sierra

Describe the Bug
Description from community member I am working with:

I discovered another issue regarding navigation/routing animations that you might have some insight into.

When quickly navigating between pages it looks like the page you're navigating away from doesn't properly get removed from the DOM, but has `opacity: 0;`. So the page that's visible can't be interacted with, while the invisible page can.

It _seems_ like it might happen when you navigate a second time before the first routing animation is complete, but that's just a hunch.

Steps to Reproduce
Steps to reproduce the behavior:

  1. clone and build app in sample repo
  2. open chrome dev tools, toggle device toobar visible, choose an iOS device and refresh
  3. click the big blue nav buttons quickly, basically while the nav is still happening
  4. eventually you will get stuck, I can do it pretty quickly when in iOS emulation mode

NOTE: May also happen in MD, but I am not that quick.

Related Code
https://github.com/vicjohnson1213/Ionic-Nav-Repro

Expected Behavior
Clicking while the nav is occurring should not have negative effects.

Additional Context
Sample repo uses beta.5. I testing locally using beta.7 and issue does still exist in beta.7

Activity

  1. adrynov commented on Oct 2, 2018

    @adrynov

    I have the same issue when coming back from a contact detail page back to the contact list page.

    The Ion-list is not tappable for a while, then it "unfreezes"

  2. orlyapps commented on Oct 26, 2018

    @orlyapps

    Same problem

  3. MarcinZiabek commented on Oct 30, 2018

    @MarcinZiabek

    I have exactly the same problem. Initially, I thought there are just random freezes but the author's suggestion that it might be connected to fast navigating between pages seems highly probably for me! In my case, it is the main thing that stops me with deploying my application to the public ;/

  4. kensodemann commented on Nov 2, 2018

    @kensodemann
    ContributorAuthor

    Updated the Ionic version to beta.15 and verified that this is still an issue: https://github.com/kensodemann/Ionic-Nav-Repro

  5. MarcinZiabek commented on Nov 20, 2018

    @MarcinZiabek

    I stopped encountering this issue since upgrade to 4.0.0-beta.16 ;) Congratulations Ionic team, well done!

  6. kensodemann commented on Nov 21, 2018

    @kensodemann
    ContributorAuthor

    This does indeed appear to be fixed, though it is fixed by virtue of the animations being disabled, so there isn't really any chance for the bug itself to manifest so far as I can tell...

  7. kensodemann commented on Nov 21, 2018

    @kensodemann
    ContributorAuthor

    Changed my sample application to use NavController to do the navigation and can confirm that this is still an issue. So two issues now:

    1. the original issue is still an issue
    2. using the original code, there is now no navigation animation
  8. vicjohnson1213 commented on Dec 3, 2018

    @vicjohnson1213

    Once the missing animations are fixed do you expect the original freezing navigation bug to reappear?

  9. plampy commented on Dec 5, 2018

    @plampy

    Appears to be fixed with beta-17. It looks like navigation between pages waits for the entrance animation to finish before navigating to another page.

  10. kensodemann commented on Dec 5, 2018

    @kensodemann
    ContributorAuthor

    Tried using my sample app updated to beta.17, both in Chrome w/ iOS emulation and on an iOS device, and in both cases I can duplicate the issue, so it is still a problem.

  11. plampy commented on Dec 5, 2018

    @plampy

    Ah, you are right. Looks like using NavController it is still an issue, but I can no longer replicate it with routerLink. On beta.17 im back to seeing the page animations navigating via routerLink with no issues bouncing back and forth quickly between pages.

  12. kensodemann commented on Dec 5, 2018

    @kensodemann
    ContributorAuthor

    Updated my demo to use routerLinks again, and at first I could not duplicate it, but home.html was using routerDirection="forward" while second.html did not specify a direction. The default apparently became "forward" since both navs where using the "forward" animation.

    When I added routerDirection="back" to second.html I could duplicate the issue again.

    Let me know if that did not make sense. I can walk whoever picks this up through that if so.

  13. hiepxanh commented on Jan 19, 2019

    @hiepxanh
    Contributor

    I have work around for one page

    ionViewWillEnter(){
        this.lastTime = Date.now();
        console.log('Time in view will enter:', this.lastTime);
    
      }
    
    backEvent() {
    let timeInBack = Date.now() - this.lastTime;
        console.log('Time in back:', timeInBack);
        if (timeInBack > 1500) {
          if (this.router.url.includes('back')) {
            console.log('normal back');
            this.navCtrl.goBack();
          } else {
            console.log('root back');
            this.navCtrl.navigateBack('/tabs/booknew');
          }
        } else {
          let currentViewPage = document.getElementsByTagName('app-spa-overview')[0];
          if (currentViewPage) {
            let waitTime = (1500 - timeInBack);
            let plusWaitTime = 2000 - waitTime;
            console.log('back too quick, remove element', waitTime + plusWaitTime);
            setTimeout(() => {
              let tabElementClassName = document.getElementsByTagName('app-tabs')[0].className;
              console.log('this tab class before:',  tabElementClassName);
              if (tabElementClassName.includes('ion-page-hidden')) document.getElementsByTagName('app-tabs')[0].className = tabElementClassName.replace('ion-page-hidden','');
              currentViewPage.parentNode.removeChild(currentViewPage);
            }, waitTime + plusWaitTime);
          } else {
            console.log('not see any element to remove');
          }
        }
    }
  14. added a commit that references this issue on Jan 22, 2019
    a945b03
  15. ionitron-bot commented on Feb 21, 2019

    @ionitron-bot

    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.

  16. locked and limited conversation to collaborators on Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions