Skip to content

Releases: pmndrs/zustand

v4.4.6

03 Nov 00:02
Compare
Choose a tag to compare

v4.4.5 has an issue with some TypeScript configs about module resolution. It should be fixed now. Thanks for the patience.

What's Changed

New Contributors

Full Changelog: v4.4.5...v4.4.6

v4.4.5

31 Oct 14:30
Compare
Choose a tag to compare

Hopefully, it should fix some issues with Node.js environment including Next.js.

What's Changed

New Contributors

Full Changelog: v4.4.4...v4.4.5

v4.4.4

21 Oct 14:05
Compare
Choose a tag to compare

There was a tiny issue in v4.4.3, which broke with some bundlers, which this version fixes.

What's Changed

  • fix(build): patch entry points zustand/shallow for CJS by @dai-shi in #2128

Full Changelog: v4.4.3...v4.4.4

v4.4.3

05 Oct 14:27
Compare
Choose a tag to compare

The changes in v4.4.2 were troublesome for some users. This version should fix/mitigate such cases.

What's Changed

Full Changelog: v4.4.2...v4.4.3

v4.4.2

02 Oct 14:14
Compare
Choose a tag to compare

This adds useShallow hook to cover some use cases that are deprecated with v4.4.0 change. Check out the guide.

Migration Guide

#1991 requires something like below if you are using the devtools middleware and TypeScript.

  import { devtools } from 'zustand/middleware'
+ import type {} from '@redux-devtools/extension'

What's Changed

New Contributors

Full Changelog: v4.4.1...v4.4.2

v4.4.1

06 Aug 23:46
Compare
Choose a tag to compare

Fixes some issues reported with the deprecated feature in v4.4.0.

What's Changed

  • fix(types): accept undefined equalityFn for the deprecated useStore by @dai-shi in #1972
  • fix: improve warning for deprecated equalityFn by @dai-shi in #1976

New Contributors

Full Changelog: v4.4.0...v4.4.1

v4.4.0

01 Aug 02:08
Compare
Choose a tag to compare

This adds new zustand/traditional entry point and deprecates equalityFn from zustand.

Migration Guide

If you don't use custom equalityFn, nothing is required.

For those who use custom equalityFn such as shallow:

// previously
import { create } from 'zustand'
const useFooStore = create((set) => ...)

// now
import { createWithEqualityFn } from 'zustand/traditional'
const useFooStore = createWithEqualityFn((set) => ..., Object.is)
// Object.is is the default quailtyFn in zustand create; to match that behavior, pass that function here. This can be updated to shallow or anything else

What's Changed

  • feat: deprecate equalityFn and add createWithEqualityFn by @dai-shi in #1945
  • fix: declare @types/react as peerDep to avoid phantom dep by @leviosa-e in #1963

New Contributors

Full Changelog: v4.3.9...v4.4.0

v4.3.9

04 Jul 14:43
Compare
Choose a tag to compare

This includes a small improvement for production build mostly for Vite users. Docs have been improved too!

What's Changed

  • fix(build): mode env for "import" condition" by @dai-shi in #1845

New Contributors

Full Changelog: v4.3.8...v4.3.9

v4.3.8

04 May 07:51
Compare
Choose a tag to compare

For persist middleware, a new option for createJSONStorage in introduced to support more cases. Note that createJSONStorage isn't a required function (and it's not very recommended as it's not type safe), and one should create a custom storage for more use cases.

What's Changed

New Contributors

Full Changelog: v4.3.7...v4.3.8

v4.3.7

31 Mar 15:16
Compare
Choose a tag to compare

This includes a couple of improvements in persist middleware.

What's Changed

  • feat(middleware/persist): add skip hydration option #405 by @gmanninglive in #1647
  • fix(middleware/persist): ensure persist does not drop updates in onRehydrateStorage when using a synchronous storage API by @coffeebeats in #1689
  • fix(middleware/persist): ensure argument for onRehydrateStorage and onHydrate is defined on first hydration by @coffeebeats in #1692

New Contributors

Full Changelog: v4.3.6...v4.3.7