1236 Commits

Author SHA1 Message Date
Charles Kornoelje
9baf0a5d38
chore(test): stop testing deprecated features and test subscribe in vanilla (#2244)
* chore(test): update test to stop testing deprecated features

* chore(test): add subscribe test for zustand/vanilla

* chore(test): only verify that subscribe exists on `create`

* chore(test): switch type of test
2023-12-13 00:46:50 +09:00
Younghoo Kim
662f38a8c3
docs(immer): change demo url (#2239) 2023-12-11 21:34:35 +09:00
Jonathan Bodling
fa04478ab2
chore(immer): fix security issue (#2228) 2023-12-10 08:31:43 +09:00
Charles Kornoelje
19960f6d96
docs(contributing): update test command (#2234) 2023-12-09 13:39:25 +09:00
daishi
50a8677dba 4.4.7 v4.4.7 2023-11-28 09:26:24 +09:00
Daishi Kato
15635ab789
chore(deps): update dev dependencies (#2217)
* chore(deps): update dev dependencies

* more typescript versions

* downgrade vite 4.5.0
2023-11-28 09:24:30 +09:00
wulimao49
949b505a4b
fix(vanilla): unexpected null state update behavior (#2213)
* fix: unexpected null state update behavior

* chore: lint code

* test: add test for setting state to null

---------

Co-authored-by: wulimao <tao@trlab.com>
2023-11-27 18:35:14 +09:00
ADTC
f5561dfb05
Add a warning to readme about React Server Components (#2202)
* Add a warning to readme about React Server Components

For more information, see https://github.com/pmndrs/zustand/discussions/2200

* Use a softer, more succinct, formally worded warning

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-11-25 00:01:24 +09:00
Geofrey Isiagi - Full-stack Web / Cloud Developer
a7b57b24d5
Update introduction.md (#2208)
* Update introduction.md

Adds Bun in the installation commands.

* Update docs/getting-started/introduction.md

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-11-23 00:47:27 +09:00
Daishi Kato
9857a676a9
refactor: revisit prettier config to be minimal (#2193) 2023-11-14 12:19:51 +09:00
daishi
a836356b5e 4.4.6 v4.4.6 2023-11-03 08:55:18 +09:00
Danilo Britto
efc8f68142
Update export types (#2170)
* Use export types

* Update package.json

* Update package exports

* Revert publint changes

* Apply publint recommendations to inner packages
2023-11-03 08:54:20 +09:00
Rustam
c500f70cbb
fix(docs): add missing param in mocked create (Vitest guide) (#2166) 2023-11-01 23:25:51 +09:00
권신학
492637a880
docs: update documentation of persist (#2147)
* docs: update documentation of persist

Add superjson serialization/deserialization example to Zustand persist documentation

* docs: fix spelling documentation of persist

* docs: Apply feedback by moving content under custom storage engine and specifying that the code is an example

* docs: Update variable name to example name and separate storage as const
2023-11-01 10:35:03 +09:00
daishi
e138de70bb 4.4.5 v4.4.5 2023-10-31 23:26:12 +09:00
Daishi Kato
5ec9c0d83b
chore(deps): update dev dependencies (#2162) 2023-10-31 23:25:36 +09:00
Danilo Britto
91157db382
Apply publint recommendations (#2157)
* Apply publint recommendations

* Minor changes

* Minor changes

* Minor changes
2023-10-31 23:14:49 +09:00
Daishi Kato
70158913da
fix: importing CJS React in ESM (#2154)
* fix: importing CJS React in ESM

* change disable comment
2023-10-31 23:14:22 +09:00
sobies93
13439986a8
Add missing parameter in mocking zustand testing guide (#2142)
It seems that the parameter was missing here, resulting in returning createUncurried instead of createUncurried(stateCreator)
2023-10-24 19:31:42 +09:00
Bram Van der Sype
643bb7ab11
Improve types in Immer middleware docs (#2139)
* Having the generic type on `immer` makes you lose introspection in IDE's.

* Add note about parenthesis and link back to typescript guide.
2023-10-23 08:44:10 +09:00
plrs9816
83b86a716c
fix(docs): support currying for testing mock (#2137)
* fix(docs): support currying for testing mock

* change function name

* fix lint error

* empty commit to trigger checks
2023-10-23 08:05:43 +09:00
daishi
93c8ca5647 4.4.4 v4.4.4 2023-10-21 22:58:18 +09:00
Daishi Kato
a67bc24839
chore(deps): update dev dependencies (#2134) 2023-10-21 22:57:14 +09:00
Daishi Kato
4abacb29af
fix(build): patch entry points zustand/shallow for CJS (#2128) 2023-10-21 22:33:20 +09:00
Daishi Kato
55ad02b375
fix(readme): avoid deprecated/misleading usage (#2132) 2023-10-21 22:32:52 +09:00
Danilo Britto
602e1e9ebe
Update reset state docs (#2119)
* Update how-to-reset-state.md

* Minor changes

* Update how-to-reset-state.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update how-to-reset-state.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-10-15 08:34:07 +09:00
daishi
90915ad1b8 4.4.3 v4.4.3 2023-10-05 23:17:07 +09:00
Daishi Kato
73ffa4b7c6
fix(types): mitigate devtools typing (#2099) 2023-10-05 23:13:27 +09:00
Danilo Britto
e414f7ccf4
fix(shallow): Extract shallow vanilla and react (#2097)
* Update readmes

* Splitting shallow in two modules

* Update tests

* Minor changes

* Minor changes

* Rename shadow.tests.tsx to shallow.test.tsx

* Add new entrypoint for shallow/react

* Update structure

* Update shallow to export from vanilla and react

* Add vanilla/shallow and react/shallow entrypoints

* Update tests

* Update readmes

* Update src/shallow.ts

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Minor changes

* Update readmes

* Update readmes

* Update tests

* Minor changes

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-10-05 23:04:56 +09:00
Danilo Britto
2be79c9154
Update testing docs (#2098)
* Update testing docs

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Update docs/guides/testing.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-10-05 08:17:28 +09:00
daishi
ec538e9d4c 4.4.2 v4.4.2 2023-10-02 22:29:21 +09:00
Daishi Kato
0504d4376a
chore(deps): update dev dependencies (#2093)
* chore(deps): update dev dependencies

* run prettier

* fix tsconfig

* fix workflow file
2023-10-02 22:28:51 +09:00
Fabrizio Vitale
3cbd468fe5
feat: add useShallow (#2090)
* feat: add useShallow

See
- https://github.com/pmndrs/zustand/discussions/1937
- https://github.com/pmndrs/zustand/discussions/1937#discussioncomment-7118242
- https://github.com/pmndrs/zustand/discussions/1937#discussioncomment-6974554

* chore(useShallow): improve unit tests

* chore(useShallow): PR feedback https://github.com/pmndrs/zustand/pull/2090#discussion_r1341963105

* fix(useShallow): tests not working on test_matrix (cjs, production, CI-MATRIX-NOSKIP)

* chore(useShallow): fix eslint warning issue (unused import)

* refactor(useShallow): simplify tests

* docs(useShallow): add guide

* fix(useShallow): prettier:ci error https://github.com/pmndrs/zustand/actions/runs/6369420511/job/17289749161?pr=2090

* docs(useShallow): update readme

* docs(useShallow): remove obsolete line from readme

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* doc(useShallow): PR feedback https://github.com/pmndrs/zustand/pull/2090#discussion_r1342120701

* docs(useShallow): small improvements of the useShallow guide

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-10-02 22:13:13 +09:00
JiWon Kim
1e846b39b1
test(ssr): Validate state synchronization between server and client in React 18 using Zustand (#903) (#2088)
* test(ssr): Validate state synchronization between server and client in React 18 using Zustand (#903)

* test(ssr): dynamically import hydrateRoot for React 18 and skip if version < 18

* test(ssr): implement conditional describe based on React version

* test(ssr): Refactor SSR code using skipIf and importActual

* test(ssr): Refactor code using 'importActual' with a more specific type for 'hydrateRoot'

* test(ssr): remove async from the main test function

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-10-02 22:08:18 +09:00
Charles Kornoelje
368478bfcb
make defaultEqualityFn optional (#2060) 2023-10-02 21:59:18 +09:00
Daishi Kato
8b242ce824
fix(types)(middleware/devtools): avoid copying types (#1991)
* fix(types)(middleware/devtools): avoid copying types

* hack for old ts

* add a note about devtools and typescript

* add a space

* Update docs/recipes/recipes.mdx

Co-authored-by: Blazej Sewera <code@sewera.dev>

* fix readme

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-10-02 21:58:10 +09:00
Danilo Britto
60d7116a5e
Remove recipes (#2085)
* Clean up files

* Update readme

* Minor changes

* Update readme.md

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Update readme.md

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Update readme.md

* Update readme.md

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-09-28 10:11:51 +09:00
stavkamil
8e8156f142
docs: change titles in order to avoid duplicate hrefs (#2071) 2023-09-22 12:53:00 +09:00
Ivan Quirino
deba6ed0d0
fix(docs): Update usage without React on recipes.mdx (#2047)
* Update usage without React on recipes.mdx

Makes recipes.mdx usage without React inline with the readme.md description, because the current recipes.mdx usage is deprecated

* Update docs/recipes/recipes.mdx

Change copy

Co-authored-by: Blazej Sewera <code@sewera.dev>

* remove empty line on recipes.mdx

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-09-14 10:03:20 +09:00
Danilo Britto
f3a0fd802b
Update slices-pattern.md (#2046)
* Update slices-pattern.md

* Update typescript.md

* Fix format

* Update typescript.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update typescript.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-09-12 21:30:08 +09:00
Daishi Kato
db76eba813
fix(docs): zustand v3 context migration doc (#2039)
* fix(docs): zustand v3 context migration doc

* Update docs/previous-versions/zustand-v3-create-context.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update docs/previous-versions/zustand-v3-create-context.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update docs/previous-versions/zustand-v3-create-context.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-09-11 18:42:55 +09:00
Mayank
504aa40e0d
upgrade @react-three/fiber (#2042)
* Ignored pnpm-lock.yaml as discussed here -
https://github.com/pmndrs/zustand/discussions/2014#discussioncomment-6837085

* fix: upgrade @react-three/fiber from 8.13.5 to 8.13.7

Snyk has created this PR to upgrade @react-three/fiber from 8.13.5 to 8.13.7.

See this package in npm:


See this project in Snyk:
https://app.snyk.io/org/mayank1513/project/d7dd1e78-71d1-4d81-8173-d307d8d0eea9?utm_source=github&utm_medium=referral&page=upgrade-pr

---------

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-09-11 12:44:18 +09:00
Mayank
dc32aee6f6
upgrade @types/tree (#2043)
* Ignored pnpm-lock.yaml as discussed here -
https://github.com/pmndrs/zustand/discussions/2014#discussioncomment-6837085

* fix: upgrade @types/three from 0.154.0 to 0.155.0

Snyk has created this PR to upgrade @types/three from 0.154.0 to 0.155.0.

See this package in npm:


See this project in Snyk:
https://app.snyk.io/org/mayank1513/project/d7dd1e78-71d1-4d81-8173-d307d8d0eea9?utm_source=github&utm_medium=referral&page=upgrade-pr

---------

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-09-11 11:55:18 +09:00
Oshri Asulin
266e8641b2
fix: added 'create' and 'shallow' imports to docs (#2028)
* add missing import, change name store, change the func in app to two variables

* Update docs/guides/updating-state.md

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-09-10 09:13:56 +09:00
Tmk
5062de1310
chore: fix ide complaints (#2032) 2023-09-08 09:58:48 +09:00
Frederik De Bleser
0ab1c0a974
fix(docs): Fix Immer import (#2029)
* Fix Immer import

The `produce` function is a named export, not a default export:

https://immerjs.github.io/immer/produce

* Fix other references to "produce" as well.
2023-09-07 08:12:20 +09:00
Danilo Britto
b8b5b636ce
Update jest codesandbox demo (#2022) 2023-09-02 08:51:06 +09:00
Mayank
b36dbf9d33
Add third party library (#2010)
* Add third party library

* added GitHub

* Update docs/integrations/third-party-libraries.md

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Update docs/integrations/third-party-libraries.md

Co-authored-by: Blazej Sewera <code@sewera.dev>

* Update docs/integrations/third-party-libraries.md

Thanks!

Co-authored-by: Blazej Sewera <code@sewera.dev>

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-08-29 07:27:58 +09:00
Mayank
4930c1e43c
Persist and sync (#2011)
* Add third party library under integrations

- [persist-and-sync](https://www.npmjs.com/package/persist-and-sync) - Zustand middleware to easily persist and
sync Zustand state between tabs / windows / iframes (SameOrigin)

* update gitignore to ignore pnpm-lock.yaml

* Comment response

- ignore only pnpm-lock
- add GitHub repo

* Undo changes to .gitignore

* update as per suggestion on another PR

+ add bungle size badge

* Update docs/integrations/third-party-libraries.md

Sure!

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>

* Update third-party-libraries.md

Improve wordings as requested

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-08-28 15:51:15 +09:00
Mayank
6a41dd8361
Ignored pnpm-lock.yaml as discussed here - (#2015)
https://github.com/pmndrs/zustand/discussions/2014#discussioncomment-6837085
2023-08-28 10:37:33 +09:00