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
It might be handy to add some helper functions for filtering actions in the reducer that would result in a no-op/unnecessary Update.
One example is if your state is an AsyncData or AsyncResult, and it's currently in an Init state, and you dispatch an action that wants to map a function over your Complete(Ok(a)) value, but you're not in that state, it's better to return a NoUpdate rather than an Update that has no effect.
Example:
Update(AsyncResult.map(v => {...v, someChange}))
vs.
getOk >> fold(NoUpdate, v => Update(...))
There might be some handy helper functions for dealing with this to avoid unnecessary updates - it would be worth thinking about.
The text was updated successfully, but these errors were encountered:
As a side note, we should benchmark if there are any actual consequences of dispatching an Update with no state changes - it's possible react optimizes this away somehow, or it's insignificant.
From a discussion with @mlms13
It might be handy to add some helper functions for filtering actions in the reducer that would result in a no-op/unnecessary
Update
.One example is if your state is an
AsyncData
orAsyncResult
, and it's currently in anInit
state, and you dispatch an action that wants to map a function over yourComplete(Ok(a))
value, but you're not in that state, it's better to return aNoUpdate
rather than anUpdate
that has no effect.Example:
There might be some handy helper functions for dealing with this to avoid unnecessary updates - it would be worth thinking about.
The text was updated successfully, but these errors were encountered: