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

ZxingScannerComponent is not releasing all resources - BrowserCodeReader still trying to decode after ngDestroy #557

Closed
RafalOddslife opened this issue Apr 24, 2024 · 3 comments
Assignees
Labels

Comments

@RafalOddslife
Copy link

Describe the bug
BrowserCodeReader is trying to decode even after destroying ZxingScannerComponent
Affected version: "@zxing/ngx-scanner": "^17.0.1"

Code

<button (click)="scannerVisible = !scannerVisible">Toggle scanner</button>
<zxing-scanner *ngIf="scannerVisible"></zxing-scanner>

To Reproduce
Steps to reproduce the behavior:

  1. Go to simple repro in stackblitz
  2. Use toggle button to init and destroy zxing-scanner component (the more you do this, the bigger the leakage)
  3. Open chrome devtools, open Performance tab and capture new recording
  4. BrowserCodeReader is still trying to decode even after destroying component

Expected behavior
All resources released

Screenshots
image

@werthdavid werthdavid self-assigned this Apr 25, 2024
werthdavid added a commit that referenced this issue Apr 25, 2024
…deReader still trying to decode after ngDestroy
@werthdavid
Copy link
Member

Thanks! Created a PR, feel free to take a look, my tests were fine. I'll merge it tmrw if nobody filed an objection..

@RafalOddslife
Copy link
Author

I've just checked and I'm unable to reproduce the error for my repro so it appears to be working correctly. Appreciate fast reaction!

werthdavid added a commit that referenced this issue Apr 25, 2024
#557 ZxingScannerComponent is not releasing all resources - BrowserCo…
@werthdavid
Copy link
Member

Released in 17.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants