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 thetemporal
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