-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Which @ngrx/* package(s) are relevant/related to the feature request?
signals
Information
In v19, we introduced a protection mechanism against mutable changes in the SignalStore. This mechanism recursively applied Object.freeze to the state object.
Since its introduction, we’ve received numerous issues and reports from the community:
- Unintentional Mutations: Many users were already mutating their state without realizing it.
- Incompatibility: Some users used types that
Object.freezewas unable to process, causing runtime errors.
The SignalStore builds on top of Angular’s Signal type, which itself does not enforce immutability through an internal mechanism like Object.freeze. This means, when developers switch to the SignalStore, they encounter a different behavior.
In certain edge cases, mutable changes within Signals are necessary to achieve specific outcomes. The current protection mechanism has proven to be more restrictive than beneficial in such scenarios, leading to frustration and workarounds.
Therefore: We propose reverting the Object.freeze protection in the SignalStore.
If immutability enforcement remains a priority for certain developers, we encourage the community to come up with solutions.
Issues and Disucssions on Object.freeze:
Describe any alternatives/workarounds you're currently using
No response
I would be willing to submit a PR to fix this issue
- Yes
- No