capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

Angular render bug on backButton with router

Open xdubx opened this issue 3 years ago • 1 comments

Bug Report

Plugin(s)

"@capacitor/android": "^4.0.1", "@capacitor/app": "^4.0.1", "@capacitor/core": "^4.0.1",

"@angular/common": "~13.3.0", "@angular/compiler": "~13.3.0", "@angular/core": "~13.3.0", "@angular/forms": "~13.3.0", "@angular/platform-browser": "~13.3.0", "@angular/platform-browser-dynamic": "~13.3.0", "@angular/router": "~13.3.0",

Capacitor Version

   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 4.0.1
  @capacitor/core: 4.0.1
  @capacitor/android: 4.0.1
  @capacitor/ios: 4.0.1

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 4.0.1
  @capacitor/android: 4.0.1
  @capacitor/core: 4.0.1

[success] Android looking great! 👌

Platform(s)

  • Android

Current Behavior

The router moves the correct destination but the page dont get rendered

image

If i press some buttons with my keyboard in the app the UI gets rendered.

Expected Behavior

The router should load the page and the items musst be rendered. My guess is that the function is started in a different context. Since I already have to update my popup with a boolen with detectChanges

Code Reproduction

page code ts

    App.addListener('backButton', ({ canGoBack }) => {
      if (canGoBack) {
        if (
          this.router.url.includes('count-item')
        ) {
          this.isExitModalVisible = !this.isExitModalVisible; // popup toggle
          this.changeDetectorRef.detectChanges(); // fix that my popup is not toggling when i press the back button again
        } else {
          //window.history.back(); // this works fine
          this.router.navigate(['home']); // creates a strange effect
        }
      } else {
        App.exitApp();
      }
    });

Other Technical Details

Iam using a Android 10 device. Same problem is reproducible on a Android 8 device. MacBook M1 with newest version VSC.

Additional Context

xdubx avatar Aug 10 '22 16:08 xdubx

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks! Ionitron 💙

Ionitron avatar Aug 15 '22 10:08 Ionitron

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day! Ionitron 💙

Ionitron avatar Aug 31 '22 00:08 Ionitron

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 the plugin, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Sep 30 '22 10:09 ionitron-bot[bot]