You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to be StrictMode compliant we had to remove an optimisation that prevented a re-render from happening if the updated state was the same. Indeed, while that optimisation was conditionally calling setState on update, in reality it was making React in StrictMode completely ignoring the update under certain conditions.
As a matter of fact, that is considered a bad practice in the docs and given the risk of such optimisation making sweet-state buggy with concurrent mode, it has been decided to let React to handle the update.
With the adoption of batching by sweet-state and based on some comments left by React devs in this issue it looks it should not be really a problem from the performance point of view.
From the testing side of things, if you we counting re-renders then I understand it might appear as children get re-rendered more (as before some re-renders were automatically skipped) but it is a trade-off we have to accept for better React consistency: every action that calls dispatch or setState will trigger a re-render even if the state is unchanged.
It seems that as of
v2.2.0
sweet state is causing double unnecessary double renders in enzyme tests.The text was updated successfully, but these errors were encountered: