Closed glenstaes closed 8 months ago
From the docs: Using effects to synchronize data by writing to signals can lead to confusing and potentially incorrect behavior, and should be enabled only when necessary.
@MarkCuypersPpw Looks like we should go with the allowSignalWrites
flag anyway. This seems to be an opt-in feature, preventing us from doing crazy things we didn't intend to do. Since the above scenario is an expected signal write, I don't see anything wrong with enabling the flag.
With the new input signals, it is now possible to have a reactive signal-way of resetting a FormGroup when the input binding of the component changes:
This is a scenario that makes sense. The input binding changes and the value of the form should reset. The end-result should be that the
hasFormChangesSig
changes its value fromtrue
tofalse
.This approach however raises an exception:
It looks like the Angular team didn't intend us to follow this approach. It is however possible to enable the
allowSignalWrites
flag, but we're hesitant to do so since this isn't the default behavior.