Omnistac / zedux

:zap: A Molecular State Engine for React
https://Omnistac.github.io/zedux/
MIT License
344 stars 7 forks source link

fix(core): always notify effects subscribers when a hydration has metadata #98

Closed bowheart closed 3 months ago

bowheart commented 3 months ago

Description

We've had a TODO to maybe inform effects subscribers when Store#setState or Store#setStateDeep are called but don't change state. We've finally figured out the behavior that's needed in this situation.

Short-circuiting is fine when state hasn't changed unless metadata is passed (e.g. setState(newState, metadataHere). When metadata is passed, the action should always proceed to all parent/child stores and notify all effects subscribers of the pseudo-action with its meta property.