Open FabienArcellier opened 9 months ago
Regarding this
initial_state.subscribe_mutation(MyState.counter, cumulative_sum)
initial_state
?It doesn't have to be explicitly called when declaring a calculated property, right?
Yes it doesn't have
Why would there be mutations to the initial_state?
It would allow to trigger automatic behavior based on property change at the application level. For example, if a counter change, we call a webhook.
When a state proxy field is modified, a signal is triggered. All functions subscribed to this signal are called with four optional argument the state proxy instance, the property name, previous value and new value.
Computed properties use this mechanism to be triggered. It is possible to have a calculated property that depends on another calculated property.
We can depends from many properties
Nested calculated property