Skip to content

Releases: pmndrs/zustand

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

v4.0.0-rc.3

19 Jul 23:59
Compare
Choose a tag to compare

v4.0.0-rc.2 has some issues with TypeScript typing which should be fixed in this version.

What's Changed

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

v4.0.0-rc.2

17 Jul 15:00
Compare
Choose a tag to compare

We've made some changes in TypeScript types. We believe what's remaining is basically docs issues. Please feel free to open issues/discussions.

What's Changed

  • 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

New Contributors

Full Changelog: v4.0.0-rc.1...v4.0.0-rc.2

v4.0.0-rc.1

29 Apr 14:33
Compare
Choose a tag to compare

This improves some types for TypeScript users. Please read ./docs for TypeScript usage and v4 migration.

What's Changed

  • 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

New Contributors

Full Changelog: v4.0.0-rc.0...v4.0.0-rc.1

v4.0.0-rc.0

18 Apr 02:12
Compare
Choose a tag to compare

Long-awaited zustand v4!

We started working on #550 at Aug 31 2021. It's been more than 7 months!

Release status

Although this release is v4.0.0-rc.0, we treat this as a normal release. While we might make some changes before the final one, the stability of this release should be same as other releases like v3.7.*.

No breaking changes in JavaScript API

Most notably, this release is backward compatible with the latest v3 API. Some features deprecated in v3 are removed in v4. It's highly recommended to update to latest v3, before upgrading to v4, and check any deprecation messages.

Big rewrite in TypeScript

Zustand code in JS is surprisingly small, and its value is actually in TypeScript. Although it is very tricky to support mutation nature of zustand middleware, @devanshj did a great job to support types as much as possible. There are some breaking changes in types from v3. Please refer ./docs/typescript.md and ./docs/v4-migration.md.

Your feedback is necessary

As always, feedback is welcome, and even necessary this time because otherwise nothing happens. Please try v4 and open issues and discussions (discussions are preferable if you are not sure which).

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

Full Changelog: v3.7.2...v4.0.0-rc.0