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

v12 fail #370

Closed
mhosman opened this issue Aug 19, 2024 · 14 comments · Fixed by #372 or #383
Closed

v12 fail #370

mhosman opened this issue Aug 19, 2024 · 14 comments · Fixed by #372 or #383

Comments

@mhosman
Copy link

mhosman commented Aug 19, 2024

It fails sometimes with error message:

"1 errors occurred during unsubscription:\n1) Error: NG0600: Writing to signals is not allowed in a computed or an effect by default. Use allowSignalWrites in the CreateEffectOptions to enable this inside effects."

The bar get stuck at 100% and is not disappearing.

@MurhafSousli
Copy link
Owner

MurhafSousli commented Aug 19, 2024

Please fill the issue template properly, what angular version are you using? and add stackblitz reproduction

@mhosman
Copy link
Author

mhosman commented Aug 19, 2024

I'm using the latest Angular version: 18.2. Is an erratic behaviour and is not related to my code:

<ng-progress ngProgressHttp ngProgressRouter flat aria-progressbar-name="progressbar"
    color="'#e91e63'"></ng-progress>

I get that error in console after loading some stuff. If i comment this ng-progress code, the error never arises.

Maybe based on the error you can find the origin:

{ "stack": "Error\n at _super (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-HBBEYCRV.js?v=84d645e1:250:22)\n at new UnsubscriptionErrorImpl (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-HBBEYCRV.js?v=84d645e1:261:5)\n at Subscription2.unsubscribe (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-HBBEYCRV.js?v=84d645e1:358:15)\n at Subscriber2.unsubscribe (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-HBBEYCRV.js?v=84d645e1:558:36)\n at Object.cleanupFn (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-Q5UIJGG6.js?v=84d645e1:122:15)\n at Object.run (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-EOEZFFSG.js?v=84d645e1:346:12)\n at EffectHandle.run (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-EOEZFFSG.js?v=84d645e1:23907:18)\n at ZoneAwareEffectScheduler.flushQueue (http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-EOEZFFSG.js?v=84d645e1:23883:14)\n at http://localhost:4200/@fs/Users/martin/dev/MyProject/core-ui/.angular/cache/18.2.0/vite/deps/chunk-EOEZFFSG.js?v=84d645e1:23874:31\n at _ZoneDelegate.invoke (http://localhost:4200/polyfills.js:300:158)", "message": "1 errors occurred during unsubscription:\n1) Error: NG0600: Writing to signals is not allowed in a computedor aneffectby default. UseallowSignalWritesin theCreateEffectOptions to enable this inside effects.", "name": "UnsubscriptionError", "errors": [ { "code": 600 } ] }

@MurhafSousli
Copy link
Owner

Make a reproduction please, I need to see the issue.

@mhosman
Copy link
Author

mhosman commented Aug 19, 2024

Sorry, I don't have time right now. I'm traveling today and I'll be off for 2 weeks.

@softworckx
Copy link

No idea that it's possible to reproduce it in Stackblitz but I'm facing exact the same issue as @mhosman.
I just upgraded from Angular 17.3 to 18.2 and from ngx-progressbar v11 to v12. I followed the wiki to change my module and styling and I'm getting the same error. I suppose the issue is somewhere in the ngProgressHttp, because that's the only way I interact with the progressbar. I can't reproduce it 100% at the same point, but when I click around in my webapp the error occurs after a few API-calls.

image

@MurhafSousli MurhafSousli linked a pull request Aug 24, 2024 that will close this issue
@MurhafSousli
Copy link
Owner

Please try with v12.0.1 and let me know!

@softworckx
Copy link

@MurhafSousli, I have given it a try and the reported issue is fixed. Thanks a lot, your new version (v12.0.1) works like a charm.

@benterris
Copy link

Hello @MurhafSousli,
I think the issue has been reintroduced in v12.0.2. I can confirm this issue is fixed in v12.0.1, but I have the exact same issue as @softworckx in the v12.0.2. It might be related to the switch from allowSignalWrites to untracked !

@MurhafSousli
Copy link
Owner

@benterris It cannot be, the fact switching to untracked is the proper way to remove this error. but the error maybe caused by you're use of the effect some where in the app.

@benterris
Copy link

benterris commented Nov 13, 2024

@MurhafSousli I don't think it comes from our end, here is a minimal reproduction on stackblitz : https://stackblitz.com/edit/stackblitz-starters-epe3b1?file=src%2Fapp%2Fhome.component.ts

It's a very basic app with a router, using NgProgressRouter and NgProgressHttp. I added a delay on the OnInit of one of the components, which triggers the issue.

My guess is that untracked does not function properly with the rxjs setup here, or maybe that some untracked are missing on the onComplete.

@MurhafSousli
Copy link
Owner

MurhafSousli commented Nov 13, 2024

@benterris besides the error, I don't think you should use both http and router features together on one progressbar because one would complete while the other is in progress, it is better to use multiple progress bars

@MurhafSousli
Copy link
Owner

@benterris It's Angular bug angular/angular#57757

@MurhafSousli
Copy link
Owner

@benterris I released a beta version v13.0.0-beta.0, This should fix the error and also allow using both http and router features in one progress bar, use npm i ngx-progressbar@beta.

let me know if this fixes your issue!

@benterris
Copy link

benterris commented Nov 15, 2024

@MurhafSousli great, I can confirm the v13.0.0-beta.0 fixes the issue 🎉
Also, it works with both http and router in a single progress bar.

Thanks a lot for your quick response !

@MurhafSousli MurhafSousli reopened this Nov 16, 2024
@MurhafSousli MurhafSousli linked a pull request Nov 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants