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
I publish as npm module just for my own convenience, it's exported as { reduxUndoable } from the @bearjam/tom package
I don't know if it's weird to change the "reducer" to a "producer", so it's producer: (draft: Draft<S>, action: A) => void as opposed to reducer: (state: S, action: A) => S that is required from the consumer...
The logic with the undo/redo might not even be bulletproof either, I only just got this working
Also I am a noob with zustand/immer and even redux lol so I might be doing something silly, but I do want to use this for a production application eventually so would be great to get feedback! Cheers!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey, I've been working on this mish-mash and just wanted to get some feedback. Is my code okay or could I go about it in a different/better way?
Code here https://github.com/bearjam/tom/blob/75d582d9f7f0d2d3a018b4b969d68b71b7fa42c5/src/zustand/middleware.ts
I publish as npm module just for my own convenience, it's exported as
{ reduxUndoable }
from the@bearjam/tom
packageI don't know if it's weird to change the "reducer" to a "producer", so it's
producer: (draft: Draft<S>, action: A) => void
as opposed toreducer: (state: S, action: A) => S
that is required from the consumer...The logic with the undo/redo might not even be bulletproof either, I only just got this working
Also I am a noob with zustand/immer and even redux lol so I might be doing something silly, but I do want to use this for a production application eventually so would be great to get feedback! Cheers!
Beta Was this translation helpful? Give feedback.
All reactions