-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
ZxingScannerComponen.init method called twice when enable flag is set to true (leak once again) #559
Comments
Is this still the case with the version from today? From looking at the code this should be resolved via #557 |
Yes, your PR fixed problem with disposing scanning process on component destroy. This issue is caused by initializing scanning process twice when |
Damnit, as setting enable to false calls the reset method I was hoping this would be resolved. I'll take a look then. Thanks |
If you setup breakpoint in ZXingScannerComponent.scanFromDevice you'll see it's called twice on component creation and |
Good point! Thank you |
#559 ZxingScannerComponen.init method called twice when enable flag i…
plz test 17.0.3 |
I'm afraid it solves my repro but the root of the problem is more complicated IMO these leaks are caused by:
Simple example: <button (click)="scannerEnable = !scannerEnable">Toggle scanner enable</button>
<zxing-scanner [enable]="scannerEnable"></zxing-scanner> it causes leak when you toggle enable flag few times quickly |
the fix is indeed not addressing the root of the problem. with my upcoming vacation I'm not sure when I will find time to look deeper into it that's why I keep the issue open. |
Hi, it's me again. I didn't notice this earlier. Issue which gives similar effect as #557 but now it's caused by [enable]="true" flag.
Describe the bug
ZxingScannerComponen.init method is called twice when enable flag is set to true which causes to run scanning twice (leak). onDestroy stops only one of scanning processes.
Affected version: "@zxing/ngx-scanner": "^17.0.2"
Code
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Component should start only one scanning process.
Screenshots
The text was updated successfully, but these errors were encountered: