npm zundo 2.0.0-beta.16
v2.0.0-beta.16 - Temporal Middleware

latest releases: 2.3.0, 2.2.0, 2.1.0...
2 years ago

New Feature!

Wrap temporal store from @SugarF0x

wrapTemporal?: (storeInitializer: StateCreator<TemporalStateWithInternals<TState>, [StoreMutatorIdentifier, unknown][], []>) => StateCreator<TemporalStateWithInternals<TState>, [StoreMutatorIdentifier, unknown][], [StoreMutatorIdentifier, unknown][]>

You can wrap the temporal store with your own middleware. This is useful if you want to add additional functionality to the temporal store. For example, you can add persist middleware to the temporal store to persist the past and future states to local storage.

Note: The temporal middleware can be added to the temporal store. This way, you could track the history of the history. 🤯

import { persist } from 'zustand/middleware'

const withTemporal = temporal<MyState>(
  (set) => ({ ... }),
  {
    wrapTemporal: (storeInitializer) => persist(storeInitializer, { name: 'temporal-persist' }),
  },
);

Size 865 B --> 888 B (increase 23 B)

What's Changed

Full Changelog: v2.0.0-beta.15...v2.0.0-beta.16

Don't miss a new zundo release

NewReleases is sending notifications on new releases.