95 Commits

Author SHA1 Message Date
Mordechai Dror
d2ac8205ec
feat(types): Make ExtractState public (#2935)
* make ExtractState public and move it to vanilla

* add docs on the matter

* Update vanilla.ts

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-01-07 22:57:18 +09:00
Alexander Mordvinov
9281ec1990
fix hydrateRoot args order (#2869) 2024-11-26 16:45:35 -05:00
Minsup Lee
15eaeb7aad
chore(docs): fix typo (#2847) 2024-11-10 10:42:32 -05:00
ytraddan
9782058029
docs: fix typo in tutorial-tic-tac-toe.md (#2836) 2024-11-05 11:30:26 -05:00
Danilo Britto
795528efb5
fix(doc): update tutorial guide and fix doc build (#2835)
* fix(doc): update tutorial guide

* fix(doc): update tutorial guide
2024-11-04 19:43:35 -05:00
Danilo Britto
bf4bcf20c5
chore(docs): update docs content (#2831)
* chore(docs): update docs content

* chore(docs): update types

* chore: update import types
2024-11-05 09:27:34 +09:00
Chafic Najjar
eac9dad35b
Fix "previous" and "next" navigation links (#2777) 2024-10-08 07:11:45 -05:00
Charles Kornoelje
717f569022
docs: remove State and improve replace typecasting (#2776) 2024-10-06 19:32:48 -05:00
Chafic Najjar
17bc89d735
docs: capitalize first word in subtitle (#2770) 2024-10-05 16:35:21 +09:00
DanThemes
976ae9fb16
Update typescript.md (#2764)
Typo: "That is to say how could **do** we type ..."
2024-10-01 17:41:15 +09:00
David
17b208a91f
docs: fix typo in Prevent rerenders with useShallow section (#2761) 2024-09-30 20:56:25 +09:00
Tibinko
c0cd364b8f
docs: typo in typescript docs (#2708) 2024-08-28 09:44:04 +09:00
Sugan Krishnan
41043478a0
Update auto-generating-selectors.md (#2695)
Keep the links consistent to github
2024-08-22 18:30:25 +09:00
Daishi Kato
e247220ece
v5 (#2138)
* prepare for the next major version

* [v5] breaking: drop default exports (#2238)

* fix: drop default exports for v5

* chore: remove default from cjs build

* refactor: export shallow in v5

* fix: remove `addModuleExport` option for cjs.

* [v5] breaking: drop deprecated features (#2235)

* fix: remove deprecated v4 features

* chore(build): remove context

* docs(typescript): remove deprecated equals api

* docs(persist): remove old persist api

* chore: run yarn prettier on typescript docs

* Discard changes to docs/guides/typescript.md

* Discard changes to docs/integrations/persisting-store-data.md

* Discard changes to tests/shallow.test.tsx

* Discard changes to tests/vanilla/subscribe.test.tsx

* [v5] breaking: make React 18 as minimal requirement (#2236)

* fix: update package.json to require react 18+

* chore: update github actions to test on react 18+

* chore: remove devtools-skip hack from actions

* chore(test): remove CI-SKIP from devtools tests

* [v5] breaking: make use-sync-external-store an optional peer dependency (#2237)

* chore: make use-sync-external-store optional peerDep

* fix: use correct versions in package.json

* [v5] breaking: require TypeScript 4.5 and update tests (#2257)

* breaking(types): TS requirement

* wip: latest only

* wip: latest only 2

* drop ts <4.4

* wip: do not skip lib checkes

* use latest node types

* drop ts 4.4

* [v5]: drop "module" condition  (#2270)

* Update package json in order to remove module

* Update rollup config in order to remove module config

* Update patch esm script

* Update package json to general exports and update node version (#2272)

* [v5]: drop UMD/SystemJS builds (#2287)

* Update rollup config in order to drop system js and umd builds

* Update packages

* Clean up files

* Update rollup config

* Update gh workflows

* Minor fixes

* Minor fixes

* Minor fixes

* Minor fixes

* Testing

* Minor changes

* Minor fixes

* remove `WithReact` type (#2300)

* 5.0.0-alpha.0

* [v5]: do not depend on use-sync-external-store (#2301)

* [v5]: do not depend on use-sync-external-store

* memo get(server)snapshot

* 5.0.0-alpha.1

* [v5]: refactor useMemoSelector (#2302)

* [v5]: refactor useMemoSelector

* add a test

* Revert "[v5]: refactor useMemoSelector"

This reverts commit b3c8b15586a270d12c335e566975021adf86c815.

* Revert "Revert "[v5]: refactor useMemoSelector""

This reverts commit 3c47301d23e18dffb7d72df36595f83570d15d08.

* [v5]: separate react entry point (#2303)

* 5.0.0-alpha.2

* 5.0.0-alpha.3

* refactor: Switch to Object.hasOwn (#2365)

* [v5] drop es5 (#2380)

* update yarn lock

* 5.0.0-alpha.4

* [v5]: follow React "standard" way with breaking behavioral change (#2395)

* [v5]: follow React "standard" way with breaking behavioral change

* add test

* 5.0.0-alpha.5

* [v5] Rewrite shallow to support iterables (#2427)

* [v5] fix rollup config for cjs (#2433)

* 5.0.0-alpha.6

* no production build test

* recover types that are dropped in #2462

* remove unused replacement

* [v5] Remove Devtools warning (#2466)

* chore: remove devtools extension warning

* docs: add devtools link to readme

* chore: remove unused test

* chrome: remove unused tests

* chore: remove unused test

* Revert "chore: remove unused test"

This reverts commit 0fa2a75f4936d960f703bf19e8f3505962cd628e.

* update test name

* update pnpm lock

* fix merge main

* add migration guide

* fix typos

* 5.0.0-beta.0

* update migration doc

* fix merge main

* fix merge main (prettier)

* 5.0.0-beta.1

* fix(types)!: require complete state if `setState`'s `replace` flag is set (#2580)

* fix(types): require complete state if `setState`'s `replace` flag is set

* switch to variant 2

* fix type errors

* update setState types for devtools and immer

* make devtools setState non-generic

* add migration guide

* merge migration guides

* run prettier

* Update tests/middlewareTypes.test.tsx

---------

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

* 5.0.0-beta.2

* move v5 migration doc

* fix ci

* missing commmit

* remove unused rule exclusion

* comment about react compiler

* revert eslint config

---------

Co-authored-by: Charles Kornoelje <33156025+charkour@users.noreply.github.com>
Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
Co-authored-by: Ekin Dursun <ekindursun@gmail.com>
Co-authored-by: Simon Farshid <simon.farshid@outlook.com>
2024-08-16 09:41:00 +09:00
Aberratio
cae5bb48bc
Update typescript.md - middleware order (#2558)
Change in the description of the order of middleware.
2024-05-17 20:36:29 +02:00
StyleShit
11cc9c3c5e
docs: fix typos in the typescript guide (#2550) 2024-05-13 10:47:11 +02:00
Chan
9d24d11e1e
Fix type in nextjs.md (#2530)
There are two typos in the error message argument.
`useCounterStore must be use` => `useCounterStore must be used`
2024-05-03 22:11:32 +09:00
Henpai Hsu
b66ccd5243
docs: update ramda example (#2510) 2024-04-26 17:07:15 +09:00
Danilo Britto
e8a5256548
Update guides (#2474)
* Update guides

* Minor fixes

* Minor changes

* Update testing.md

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

* Update testing.md

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

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2024-04-16 10:56:39 +09:00
Dawid
fc2f85afff
Update third-party-libraries.md (#2435)
* Update third-party-libraries.md

* docs: order davstack store link alphabetically

* docs: add link to 3rd party autogenerated selectors library

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

change the dash

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

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2024-03-27 08:54:37 +09:00
Elie Schoppik
08fd864417
Fixing typo in nextjs.md (#2416)
intialize -> initialize
2024-03-16 08:21:54 +09:00
Michael Di Prisco
1392c51fae
docs: adding note about middlewares and slices (#2378)
* docs: adding note about middlewares and slices

* chore: updating slices note

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

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
2024-03-02 06:39:16 +09:00
Carsten Dietzel
827d5aacaf
Fix typo in prevent-rerenders-with-use-shallow.md (#2364) 2024-02-29 00:08:07 +09:00
Mohamed Yahye El Joud
08d13764ba
Update ssr-and-hydration.md (#2353)
* Update ssr-and-hydration.md

Small typo

* Update docs/guides/ssr-and-hydration.md

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>
2024-02-22 18:14:16 +09:00
Danilo Britto
8c1a1f0327
Update nextjs guide (#2328)
* Update nextjs guide

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes
2024-02-16 11:58:13 +09:00
Charles Kornoelje
eb8443faa3
docs(middleware): modify both set and setState (#2306)
* docs(middleware): modify `set` and `setState`

* update middleware docs
2024-02-15 22:21:29 +09:00
Danilo Britto
b466a7585e
Update nextjs.md (#2324) 2024-02-10 09:14:38 +09:00
Alexander Densley
02ddd70d5b
fix broken link caused by typo (#2321) 2024-02-09 09:53:19 +09:00
Danilo Britto
f64a111b85
Update docs related to SSR/Hydration and SSR Apps (#2298)
* Update deprecation comments

* Update testing guide

* WIP

* Minor fixes

* WIP

* Update docs/guides/ssr-and-hygration.md

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

* Update docs/guides/ssr-and-hygration.md

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

* WIP

* Minor changes

* Minor changes

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update nextjs.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update ssr-and-hygration.md

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

* Update docs/guides/nextjs.md

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

* Update docs/guides/ssr-and-hygration.md

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

* Update docs/guides/nextjs.md

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

* Minor fixes

* Update docs/guides/nextjs.md

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

* Update docs/guides/nextjs.md

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

* Update docs/guides/ssr-and-hydration.md

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

* Update docs/guides/ssr-and-hydration.md

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

* Update docs/guides/ssr-and-hydration.md

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

* Update docs/guides/ssr-and-hydration.md

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

* Update docs/guides/nextjs.md

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

* Update docs/guides/nextjs.md

Co-authored-by: Charles Kornoelje <33156025+charkour@users.noreply.github.com>

* Update docs/guides/ssr-and-hydration.md

Co-authored-by: Charles Kornoelje <33156025+charkour@users.noreply.github.com>

* Update ssr-and-hydration.md

* Update docs/guides/ssr-and-hydration.md

Co-authored-by: Charles Kornoelje <33156025+charkour@users.noreply.github.com>

---------

Co-authored-by: Blazej Sewera <code@sewera.dev>
Co-authored-by: Charles Kornoelje <33156025+charkour@users.noreply.github.com>
2024-02-08 18:13:36 +09:00
Cody Partington
4be1e9eb4a
fix(docs): errors and types fix for URL state example (#2218)
* Update connect-to-state-with-url-hash.md

Resolved a few errors and type errors in the persist and create state with URL example:

1. createJsonStorage not being called in storageOptions resulting in a type error.
2. Correct hook not being exported
3. Moved the creation of initial state inline to get the correct types passed from create/persist.
4. Used state type as generic for persist.

* yarn prettier run

* Update docs/guides/connect-to-state-with-url-hash.md

Better name for state in setter

Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>

* prettier run

---------

Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-12-31 22:29:34 +09:00
Andrew Hulterstrom
a4578fa5c4
docs: minor typo fix in flux-inspired-practice.md (#2252) 2023-12-15 09:08:06 +09:00
Charles Kornoelje
41838c5187
chore(docs): rewrite to remove deprecated references in persist docs (#2248)
* chore(docs): rewrite to remove deprecated references in persist docs

* chore(docs): remove deprecated equalityFn
2023-12-14 08:05:20 +09:00
Daishi Kato
9857a676a9
refactor: revisit prettier config to be minimal (#2193) 2023-11-14 12:19:51 +09:00
Rustam
c500f70cbb
fix(docs): add missing param in mocked create (Vitest guide) (#2166) 2023-11-01 23:25:51 +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
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
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 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
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
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
Danilo Britto
b8b5b636ce
Update jest codesandbox demo (#2022) 2023-09-02 08:51:06 +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
Daishi Kato
5777a65cf5
chore(deps): update dev dependencies (#1965) 2023-08-01 10:42:18 +09:00
Tiago Bento
6d9c0cff0d
Fix slices-pattern.md link on flux-inspired-practice.md (#1962) 2023-07-28 09:39:58 +09:00