Skip to content

Releases: charkour/zundo

v2.0.0-beta.22 - Reduce size by moving internals

15 Jun 23:44
Compare
Choose a tag to compare

839 B --> 833 B

What's Changed

Full Changelog: v2.0.0-beta.21...v2.0.0-beta.22

v2.0.0-beta.21 - isTracking Flag

15 Jun 22:27
Compare
Choose a tag to compare
Pre-release

852 B --> 839 B

Breaking Change

- trackingStatus: 'tracking' | 'paused'
+ isTracking: boolean

- trackingStatus === 'tracking'
+ isTracking === true

- trackingStatus === 'paused'
+ isTracking === false

Stop and start history

isTracking: boolean

isTracking: a stateful flag in the temporal store that indicates whether the temporal store is tracking state changes or not. Possible values are true or false. To programmatically pause and resume tracking, use pause() and resume() explained below.

Pause tracking of history

pause: () => void

pause: call function to pause tracking state changes. This will prevent new states from being stored in history within the temporal store. Sets isTracking to false.

Resume tracking of history

resume: () => void

resume: call function to resume tracking state changes. This will allow new states to be stored in history within the temporal store. Sets isTracking to true.

What's Changed

Full Changelog: v2.0.0-beta.20...v2.0.0-beta.21

v2.0.0-beta.20 - Only copy when necessary

10 Jun 16:57
Compare
Choose a tag to compare

850 B --> 852 B

What's Changed

New Contributors

Full Changelog: v2.0.0-beta.19...v2.0.0-beta.20

v2.0.0-beta.19 - Smaller Bundle Size by 0.82%

05 Jun 00:22
Compare
Choose a tag to compare

857 B --> 850 B

What's Changed

Full Changelog: v2.0.0-beta.18...v2.0.0-beta.19

v2.0.0-beta.18 - Improve _handleSet, shave 20 bytes (2.3% smaller)

27 May 14:31
Compare
Choose a tag to compare

877 B --> 857 B (Shave 20 bytes)

What's Changed

Full Changelog: v2.0.0-beta.17...v2.0.0-beta.18

v2.0.0-beta.17 - Drop Node 14, Smaller Bundle by 1.2%

23 May 12:31
Compare
Choose a tag to compare

888 B --> 877 B (save 11 bytes)

Breaking

  • Node 14 is no longer supported
  • The internal types have been renamed

What's Changed

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

v2.0.0-beta.16 - Temporal Middleware

04 May 01:10
Compare
Choose a tag to compare
Pre-release

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

v2.0.0-beta.15 - Init states

23 Apr 03:55
Compare
Choose a tag to compare
Pre-release

New feature!

Initialize temporal store with past and future states

pastStates?: Partial<PartialTState>[]

futureStates?: Partial<PartialTState>[]

You can initialize the temporal store with past and future states. This is useful when you want to load a previous state from a database or initialize the store with a default state. By default, the temporal store is initialized with an empty array of past and future states.

Note: The pastStates and futureStates do not respect the limit set in the options. If you want to limit the number of past and future states, you must do so manually prior to initializing the store.

const withTemporal = temporal<MyState>(
  (set) => ({ ... }),
  {
    pastStates: [{ field1: 'value1' }, { field1: 'value2' }],
    futureStates: [{ field1: 'value3' }, { field1: 'value4' }],
  },
);

Related #75

847 B --> 865 B (increase 18 bytes)

What's Changed

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

v2.0.0-beta.14 - 2.4% smaller

22 Apr 22:12
Compare
Choose a tag to compare
Pre-release

Reduce package size by 21 bytes.
868 B --> 847 B

What's Changed

  • switch config for better types and save bytes by @charkour in #83

Full Changelog: v2.0.0-beta.13...v2.0.0-beta.14

v2.0.0-beta.13 - 7.3% smaller bundle

22 Apr 21:45
Compare
Choose a tag to compare
Pre-release

7.3% smaller by shaving 69 bytes. Add better React tests
937 bytes --> 868 bytes

Breaking change

This a potentially breaking change for those who rely on internal properties.

// Before
myStore.temporal.getState().__interal.onSave

// After
myStore.temporal.getState().__onSave

// Before
myStore.temporal.getState().__interal.handleuserSet

// After
myStore.temporal.getState().__handleUserSet

What's Changed

  • restructure __internals to shave bytes; add react tests by @charkour in #82

Full Changelog: v2.0.0-beta.12...v2.0.0-beta.13