store icon indicating copy to clipboard operation
store copied to clipboard

🐞[BUG]: Dispatching an Action within an `effect` causes an error

Open LiamMorrow opened this issue 8 months ago • 1 comments

Affected Package

ngxs/store

Is this a regression?

Yes, the previous version in which this bug was not present was: 3.8

Description

When dispatching an action which will set the state from an angular signals effect, an error now occurs saying that signals cannot be updated within an effect.

A workaround is to call the dispatch within an untracked, however the stack we get from angular is quite terrible, and having to do this for every dispatch is not a great devex.

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-17-starter-project-8ekglh?file=src%2Fmain.ts

🔥 Exception or 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.

Environment


Libs:
- @angular/core version: 17.0.0
- @ngxs/store version: 18.0.0


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

LiamMorrow avatar Jun 27 '24 04:06 LiamMorrow