Skip to content

Releases: pmndrs/zustand

v4.3.0

10 Jan 10:45
Compare
Choose a tag to compare

Throughout past years of development, we've learned the (mis)usage of the library. One of our goal is to provide smallest possible APIs. To go further, this version deprecates some features. They are still usable (with warnings), but will be removed in the future.

What's Changed

  • feat: deprecate some APIs toward v5 by @dai-shi in #1403
  • feat: deprecate default export by @dai-shi in #1514
  • fix(middleware/persist): hydrate in sync (new impl with storage option) by @dai-shi in #1518

New Contributors

Full Changelog: v4.2.0...v4.3.0

v4.2.0

01 Jan 01:15
Compare
Choose a tag to compare

This version adds some new features in middleware.

What's Changed

  • feat(middleware/devtools): Better redux devtools. One connection for all zustand stores by @pavlobu in #1435
  • feat(middleware/persist): new storage option by @dai-shi in #1463
  • fix(build): disable esModule and re-export for nodejs by @barelyhuman in #1486

New Contributors

Full Changelog: v4.1.5...v4.2.0

v4.1.5

05 Dec 13:22
Compare
Choose a tag to compare

This version has several small improvements.

What's Changed

  • fix(middleware/devtools): do not use optional catch binding syntax by @mskrzypek in #1431
  • feat(shallow): Add support of Maps and Sets to shallow comparator by @anton-lunev in #1451
  • refactor(vanilla/types): replace hardcoded types with StoreApi type by @Arsikod in #1459
  • Fix: Programmatic module.exports addition for named and default exports in CJS by @barelyhuman in #1460

New Contributors

Full Changelog: v4.1.4...v4.1.5

v4.1.4

31 Oct 12:52
Compare
Choose a tag to compare

This should improve some importing problems. Uncertain if it fixes everything.

What's Changed

  • fix(build): use *.d.mts for esm ('import' condition only) by @dai-shi in #1387
  • fix(build): no import.meta for "module" condition by @dai-shi in #1393

New Contributors

Full Changelog: v4.1.3...v4.1.4

v4.1.3

23 Oct 01:30
Compare
Choose a tag to compare

This improves store types for TS users. We also upgrade rollup. Please report issues if anyone finds any.

What's Changed

  • fix(types): assume getState and setState will always exist on the store by @devanshj in #1371
  • fix(types): fix StateCreator subtyping by @devanshj in #1373

New Contributors

Full Changelog: v4.1.2...v4.1.3

v4.1.2

09 Oct 05:48
Compare
Choose a tag to compare

This includes some fixes for edge cases. Most notably, supporting old TypeScript versions.

What's Changed

  • fix(context): store property missing from useStoreApi by @exuanbo in #1258
  • fix: should use Object.is to compare two value by @hchlq in #1314
  • Rewrite TakeTwo, SkipTwo and Mutate to make them work for older ts versions too by @devanshj in #1348

New Contributors

Full Changelog: v4.1.1...v4.1.2

v4.1.1

22 Aug 02:35
Compare
Choose a tag to compare

In v4.1.0, there are some TypeScript type issues in redux and devtools middleware, which should be fixed.

What's Changed

  • fix(middleware): revert types of redux middleware by @dai-shi in #1206
  • fix(types)(middleware/devtools): copy devtools option types instead of importing by @dai-shi in #1207
  • refactor(types): prefer using import type by @dai-shi in #1208

Full Changelog: v4.1.0...v4.1.1

v4.1.0

18 Aug 23:30
Compare
Choose a tag to compare

This supports non-object state. It's probably one of the biggest changes in API design throughout the zustand development history. But, probably 99.9% of users won't use it 😝 .

What's Changed

New Contributors

Full Changelog: v4.0.0...v4.1.0

v4.0.0

26 Jul 01:31
Compare
Choose a tag to compare

πŸŽ‰ πŸŽ‰ πŸŽ‰ Zustand v4 is here πŸŽ‰ πŸŽ‰ πŸŽ‰

Backward compatible with v3 in JS

v4 API is completely backward compatible, so it's just nothing to update if you are JS users.

One note is v4 depends on use-sync-external-store.
There might be some bundling issues.
Please report them if you encounter such cases.

TypeScript types are rewritten

To better support types with middleware, v4 TypeScript code is rewritten.
Please find docs/typescript.md for more information.

New API for context usage

In v3, zustand/context is provided as a workaround.
v4 API exposes createStore and useStore, which are more flexible.
Please read this for usage.
If you are unsure about the usage, open a new discussion.

Counter example: https://codesandbox.io/s/polished-pond-4jn1e2

Deprecated APIs are removed

Some APIs are already deprecated in v3, and they are removed in v4. Please make sure to update to the latest version of v3 before migrating to v4.

What's Changed

  • breaking(vanilla): drop deprecated store.subscribe with selector by @dai-shi in #604
  • breaking(middleware): drop deprecated persist options and make removeItem required by @dai-shi in #598
  • breaking(core): drop v2 hook compatibility by @dai-shi in #597
  • breaking(types): drop deprecated UseStore type by @dai-shi in #596
  • feat: use-sync-external-store by @dai-shi in #550
  • breaking(middleware/devtools): use official devtools extension types by @dai-shi in #819
  • breaking(middleware/devtools): remove deprecations and warnings by @devanshj in #892
  • fix(build): separate vanilla build by @dai-shi in #904
  • breaking(types): Add higher kinded mutator types by @devanshj in #725
  • fix(index): export createStore from vanilla by @dai-shi in #914
  • fix(middleware): separate immer middleware by @dai-shi in #915
  • fix(middleware/devtools): add enabled option and show devtools warning only if enabled by @Aslemammad in #880
  • breaking(middleware/devtools): remove checking old string option by @dai-shi in #933
  • Fix TS4023 and other minor changes by @devanshj in #940
  • fix(types): avoid any in react.ts by @dai-shi in #941
  • fix(build): add downlevel-dts by @dai-shi in #1005
  • refactor: prefer interfaces by @dai-shi in #1012
  • fix(types): Mark more methods bivariant by @RyanCavanaugh in #1029
  • fix(types): remove Partial typo from persist by @devanshj in #1051
  • fix(shallow): restrict types by @dai-shi in #1070
  • feature(persist): add method getOptions on persist api and update documentation by @tbor00 in #1075
  • feat(types): minimize types by deprecating them by @devanshj in #1089
  • fix(build): a workaround for ESM for use-sync-external-store by @dai-shi in #953
  • fix(types): use TS interfaces only for public api by @dai-shi in #1106
  • fix(shallow): types with useStore by @dai-shi in #1108
  • fix(shallow): types with useStore again by @dai-shi in #1117
  • refactor(types): avoid using deprecated types by @dai-shi in #1122

New Contributors

Full Changelog: v3.7.2...v4.0.0

v4.0.0-rc.4

20 Jul 23:22
Compare
Choose a tag to compare

There was still a tiny issue with typing in zustand/shallow, and it's finally fixed.

What's Changed

Full Changelog: v4.0.0-rc.3...v4.0.0-rc.4