Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zundo v2 #43

Merged
merged 45 commits into from
Sep 23, 2022
Merged

zundo v2 #43

merged 45 commits into from
Sep 23, 2022

Conversation

charkour
Copy link
Owner

@charkour charkour commented Aug 3, 2022

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:

  • Support zustand v4
  • modify zustand types to support temporal object
  • create temporal factory function (undo, redo, clear, pastStates, futureStates)
  • persist option (to replace include and exclude)
  • add steps param to undo and redo
  • Add option to pause and resume history tracking (pause(): void, resume(): void, state: 'tracking' | 'paused')
  • Add optional historyDepthLimit as limit
  • Add option to pass equality function to save states (rather than bundling lodash/isEqual)
  • Add option to provide a callback when state is saved in temporal store. onSave
  • Add handleSet middleware. Add option to set coolDownTime. Maybe we can allow the user to pass in a function rather then writing it ourself? Debounce vs Throttle
  • 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

@charkour charkour added this to the v2 milestone Aug 3, 2022
@charkour charkour self-assigned this Aug 3, 2022
@charkour charkour added enhancement New feature or request help wanted Extra attention is needed labels Aug 3, 2022
@charkour
Copy link
Owner Author

charkour commented Sep 6, 2022

Might need to update tests to use React ACT: https://github.com/pmndrs/its-fine/blob/main/tests/setupTests.ts

@charkour charkour marked this pull request as ready for review September 23, 2022 02:14
@charkour charkour merged commit 39a50fd into main Sep 23, 2022
@charkour charkour deleted the v2 branch September 23, 2022 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants