zundo
zundo copied to clipboard
zundo v2
After a year of the v1, it's finally time for the next major release of zundo. The goal is to create a smaller bundle size, have an easier API, and improve type correctness.
All new work is being done in packages/zundo
Here is a checklist that is required before v2 can be released:
- [x] Support zustand v4
- [x] modify zustand types to support
temporal
object - [x] create temporal factory function (
undo
,redo
,clear
,pastStates
,futureStates
) - [x]
persist
option (to replaceinclude
andexclude
) - [x] add steps param to
undo
andredo
- [x] Add option to pause and resume history tracking (
pause(): void, resume(): void, state: 'tracking' | 'paused'
) - [x] Add optional
historyDepthLimit
aslimit
- [x] Add option to pass
equality
function to save states (rather than bundlinglodash/isEqual
) - [x] Add option to provide a callback when state is saved in temporal store.
onSave
- [x] Add
handleSet
middleware. ~Add option to setcoolDownTime
.~ Maybe we can allow the user to pass in a function rather then writing it ourself? Debounce vs Throttle - [x] chained middleware support
- [ ] update readme IN PROGRESS
- [ ] dev tools support IN PROGRESS
Future versions of v2
- [ ] create nicer API, or a helper hook in react land (useTemporal). or vanilla version of the it
- [ ] Allow alternative storage engines for past and future states
- [ ] See if it canUndo and canRedo
- [ ] Set initial history, past and future states
- [ ] create
jump
method that takes an integer - [ ] create a
present
object that holds the current state? perhaps - [ ] support history branches rather than clearing the future states
- [ ] Pass middleware to temporal store
- [ ] store state delta rather than full object
Might need to update tests to use React ACT: https://github.com/pmndrs/its-fine/blob/main/tests/setupTests.ts