Releases: pmndrs/zustand
v4.1.5
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
- @wmcb91 made their first contribution in #1398
- @chrisvander made their first contribution in #1426
- @boatilus made their first contribution in #1428
- @chybisov made their first contribution in #1453
- @hicucu made their first contribution in #1438
- @mskrzypek made their first contribution in #1431
- @anton-lunev made their first contribution in #1451
- @Arsikod made their first contribution in #1459
Full Changelog: v4.1.4...v4.1.5
v4.1.4
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
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
andsetState
will always exist on the store by @devanshj in #1371 - fix(types): fix
StateCreator
subtyping by @devanshj in #1373
New Contributors
- @dongkun made their first contribution in #1352
- @srini-leanfolks made their first contribution in #1357
Full Changelog: v4.1.2...v4.1.3
v4.1.2
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
andMutate
to make them work for older ts versions too by @devanshj in #1348
New Contributors
- @chrisk-7777 made their first contribution in #1222
- @timarney made their first contribution in #1223
- @radaelilucca made their first contribution in #1230
- @Exalted100 made their first contribution in #1231
- @dbritto-dev made their first contribution in #1236
- @guymoon made their first contribution in #1267
- @cuppachino made their first contribution in #1291
- @mugi-uno made their first contribution in #1303
- @hchlq made their first contribution in #1315
- @DiemasMichiels made their first contribution in #1325
- @FKSI made their first contribution in #1326
- @Rec0iL99 made their first contribution in #1344
- @kpue made their first contribution in #1346
- @exuanbo made their first contribution in #1258
Full Changelog: v4.1.1...v4.1.2
v4.1.1
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
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
- fix(types)(middleware/devtools): fix action type in devtools's setState by @lucasrabiec in #1183
- feat(vanilla): non-object state by @dai-shi in #1144
- fix(types)(middleware): use official Config type for options by @dai-shi in #1200
- fix(types): typo in jsdoc and follow-up #1144 by @devanshj in #1199
New Contributors
- @garrett-hopper made their first contribution in #1152
- @satvikpendem made their first contribution in #1163
- @markroze made their first contribution in #1188
- @lucasrabiec made their first contribution in #1184
- @spenceradolph made their first contribution in #1193
Full Changelog: v4.0.0...v4.1.0
v4.0.0
π π π 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 frompersist
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
- @piotr-cz made their first contribution in #927
- @mahendradambe made their first contribution in #956
- @himself65 made their first contribution in #978
- @jenglamlow made their first contribution in #988
- @InfiniteXyy made their first contribution in #1006
- @guilleon-velasco made their first contribution in #1009
- @sepehr-safari made their first contribution in #1049
- @rnike made their first contribution in #1056
- @tbor00 made their first contribution in #1071
- @Carnageous made their first contribution in #1057
- @xlboy made their first contribution in #1082
- @RyanCavanaugh made their first contribution in #1029
- @Gabriel-Alves-Cunha made their first contribution in #997
- @chann44 made their first contribution in #1016
Full Changelog: v3.7.2...v4.0.0
v4.0.0-rc.4
There was still a tiny issue with typing in zustand/shallow
, and it's finally fixed.
What's Changed
- fix(shallow): types with useStore again by @dai-shi in #1117
- refactor(types): avoid using deprecated types by @dai-shi in #1122
Full Changelog: v4.0.0-rc.3...v4.0.0-rc.4
v4.0.0-rc.3
v4.0.0-rc.2 has some issues with TypeScript typing which should be fixed in this version.
What's Changed
- fix(types): use TS interfaces only for public api by @dai-shi in #1106
- fix(shallow): types with useStore by @dai-shi in #1108
Full Changelog: v4.0.0-rc.2...v4.0.0-rc.3
v4.0.0-rc.2
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 frompersist
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
- @mahendradambe made their first contribution in #956
- @himself65 made their first contribution in #978
- @jenglamlow made their first contribution in #988
- @InfiniteXyy made their first contribution in #1006
- @guilleon-velasco made their first contribution in #1009
- @sepehr-safari made their first contribution in #1049
- @rnike made their first contribution in #1056
- @tbor00 made their first contribution in #1071
- @Carnageous made their first contribution in #1057
- @xlboy made their first contribution in #1082
- @RyanCavanaugh made their first contribution in #1029
Full Changelog: v4.0.0-rc.1...v4.0.0-rc.2