Batched updates
#1803
Replies: 1 comment 6 replies
-
We made a decision to rely on React for batching. It should cover most cases. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Zustand is great, but it does not currently support one feature that would help me a lot - batch updates. Batch updates are useful when multiple state changes need to be made within a single action or event.
One approach to adding batch update support is to add a new method to the store object, such as
batchUpdate()
, that accepts a callback function. This function would contain all the state updates that need to be made, and Zustand would ensure that they are all executed together as a single atomic transaction or pause listeners and trigger them afterbatchUpdate
will finish. Another approach would be to add a middleware.Beta Was this translation helpful? Give feedback.
All reactions