1009 Commits

Author SHA1 Message Date
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
Danilo Britto
862c7bdd0f
Update testing docs (#2008)
* Update testing docs

* Minor fixes

* Minor fixes

* Update testing.md
2023-08-27 10:21:20 +09:00
John Gilliland
9ddfced2ea
docs: Update typescript guide persist examples... (#2001)
* docs: Update typescript guide persist examples to add required name option

* docs: run prettier

* docs: reverting prettier changes to testing.md

* docs: Update docs/guides/typescript.md per review comment.

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

* docs: Update docs/guides/typescript.md per review comment and zustand conventions.

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

* docs: change persist options name property to bearStore for consistency.

---------

Co-authored-by: John Gilliland <John.Gilliland@Starz.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-08-25 16:54:04 +09:00
Michel Sabchuk
0058a03b78
fix(docs): Do not recommend deprecated useStore + equalityFn on initialize with props docs (#1997)
* Do not recommend deprecated useStore + equalityFn

* Show alternative without equality function

* Adjust content to be more clear

* Update docs/guides/initialize-state-with-props.md

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

* Apply prettier

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-08-17 08:16:19 +09:00
Aykut Kardaş
5493959646
docs: update persisting-store-data.md (#1993) 2023-08-15 08:30:19 +09:00
Daishi Kato
49d43b7ddd
fix(readme): description with createWithEqualityFn (#1985)
* fix(readme): description with createWithEqualityFn

* fix wording

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-08-12 19:04:46 +09:00
daishi
0426978490 4.4.1 v4.4.1 2023-08-07 08:41:49 +09:00
Daishi Kato
29e1820784
chore(deps): update dev dependencies (#1981) 2023-08-07 08:41:21 +09:00
Daishi Kato
a10dd1c669
fix: improve warning for deprecated equalityFn (#1976)
* fix: improve warning for deprecated equalityFn

* fix tsc error
2023-08-07 08:26:50 +09:00
Daishi Kato
1a9b309844
fix(types): accept undefined equalityFn for the deprecated useStore (#1972) 2023-08-07 08:24:29 +09:00
Juhyeok Kang
19d3df22a6
docs: fix typo (#1969) 2023-08-03 08:40:20 +09:00
daishi
2778e71c84 4.4.0 v4.4.0 2023-08-01 10:46:16 +09:00
Daishi Kato
5777a65cf5
chore(deps): update dev dependencies (#1965) 2023-08-01 10:42:18 +09:00
leviosa-e
a2ad770903
fix: declare @types/react as peerDep to avoid phantom dep (#1963) 2023-08-01 10:15:28 +09:00
Daishi Kato
c6900a4562
feat: deprecate equalityFn and add createWithEqualityFn (#1945)
* feat: deprecate equalityFn and add createWithEqualityFn

* add link to deprecation message
2023-08-01 10:15:09 +09:00
Tiago Bento
6d9c0cff0d
Fix slices-pattern.md link on flux-inspired-practice.md (#1962) 2023-07-28 09:39:58 +09:00
cwtuan
43791eb8dc
add usage trends in readme.md (#1953)
* add usage trends in readme.md

* usage trend of zustand

* Update link

* Update comparison.md

add link to npm trend

* Update comparison.md

* fix: ci

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-07-27 21:16:08 +09:00
Itay
c5e7c30660
avoid 'any' errors and make example clearer (#1957) 2023-07-26 16:29:17 +09:00
f11cc7f37a example: correct entry index.html 2023-07-16 15:58:51 +02:00
8194bdf41a example: favicon & manifest 2023-07-16 15:54:25 +02:00
1c660b4de3 example: clean up styles 2023-07-16 15:45:00 +02:00
307c025066 examples: fix prettier / lint 2023-07-16 14:54:03 +02:00
47649176e0 update example, move to vite 2023-07-16 14:46:05 +02:00
Tuan Anh
642b0bc055
fix doc typo (#1932)
Co-authored-by: anhdoecourier <tdo@e-courier.com>
2023-07-15 15:18:44 +09:00
Mohammed 'Mo' Mulazada
f73736d59a
improve docs readability (#1931)
* make codeblock easier to understand

* add explanation to what mock does

* add info block

* rewrite typescript section

* Update typescript.md

* Update docs/guides/testing.md

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

* prefix with >

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-07-13 18:01:47 +09:00
Luiz Felicio
808a72225e
docs(auto-generating-selectors): Add vanilla store variant (#1915)
* Add variant for vanilla stores

* Update text tone and style

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

* Adjust code style to match zustand's one

* Run prettier

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-07-05 08:38:35 +09:00
daishi
ea40986e46 4.3.9 v4.3.9 2023-07-04 23:37:13 +09:00
Daishi Kato
16cafcaeaf
chore(deps): update dev dependencies (#1919) 2023-07-04 23:36:23 +09:00