257 Commits

Author SHA1 Message Date
Leo López
618c2e5a76
docs(readme): fix import of "produce" function (#1844) 2023-06-07 10:41:19 +09:00
Valerii Petryniak
dfa779b14d
Update readme.md: add pnpm as install option (#1819)
* Update readme.md: add pnpm as install option

* Update readme.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>
2023-05-21 07:55:27 +09:00
imspace
6d47b60410
fix(docs): broken testing doc link (#1742) 2023-04-08 20:33:24 +09:00
Daishi Kato
0b55a3d74b
feat: deprecate default export (#1514) 2023-01-10 18:13:25 +09:00
Daishi Kato
7d32f9c7c9
feat: deprecate some APIs toward v5 (#1403)
* feat: deprecate some APIs toward v5

* update docs
2023-01-10 17:36:24 +09:00
daishi
0ef5d1e81b fix a badge 2023-01-05 20:50:18 +09:00
Adil Ismail
f01d5afc87
docs: Fixed minor grammar & typo issues (#1502) 2023-01-02 11:33:10 +09:00
Daishi Kato
1e986ec97f
feat(middleware/persist): new storage option (#1463)
* feat(middleware/persist): new storage option

* fix typo
2023-01-01 09:57:19 +09:00
Paul Pavlo Buidenkov
633c7dd7af
feat(middleware/devtools): Better redux devtools. One connection for all zustand stores (#1435)
* add example project for zustand devonly devtools with better rewind feature of redux devtools

* fix yarn install for demo

* remove lodash from demo

* adjust utils

* remove assets from demo project

* add codesandbox

* devtools for groups of stores

* remove command from .yml

* add tests

* cleanup

* Existing test cleanup

* Slight test cleanup; extract iife

* Slight cleanup

* Non-recursive S

* Remove initialState

Co-authored-by: Corin (CWStra) <cwstra@gmail.com>
2023-01-01 09:43:54 +09:00
Blazej Sewera
b1cea640c8
Revise the third-party libraries documentation page (#1478)
* docs(#1220): third-party libraries page revision

- Make Zustand name always start from a capital letter,
- Unify list formatting and description style,
- Change minuses to em-dashes,
- Change 3rd to third.

* docs(#1220): update links from 3rd-party to third-party
2022-12-15 12:26:09 +09:00
Devansh Jethmalani
d27ea94884
Update slices pattern links in readme and flux guide (#1353)
* readme: link slices pattern guide

* docs: update slices pattern link in flux guide
2022-10-14 21:22:39 +09:00
Chris K
94dec53d9a
docs: fix image spacing. fix phrasing and various grammar issues (#1333) 2022-10-02 07:27:31 +09:00
François KY
d60f0cca7a
docs: expose enabled devtools options in the documentation (#1326) 2022-10-01 18:12:24 +09:00
Daishi Kato
f0ff30f7c4
chore(examples): move to demo subdir and eliminate rewired (#1305)
* chore(examples): move to demo subdir and eliminate rewired

* fix some paths

* run prettier

* use v4
2022-09-22 18:34:36 +09:00
Chris K
b739cfdb1e
docs: remove dead link from readme (#1302) 2022-09-20 22:52:44 +09:00
Lucca Radaeli
a413f4a340
docs: fix broken links on readme (#1230) 2022-08-28 16:36:37 +09:00
Tim Arney
19557ba286
Fix TypeScript docs link (#1223)
Updates link to look in the guides directory
2022-08-25 22:30:22 +09:00
Łukasz Rabiec
ed12c7edab
fix(types)(middleware/devtools): fix action type in devtools's setState (#1183)
* added payload to setState() in devtools middleware

* adjusted tests

* changed payload to any property name

* adjusted docs

* prettier readme.md

* adjusted for extends

* adjusted immer's setState

* Revert "adjusted immer's setState"

This reverts commit 50ce327bf0031a0ec61177b47733f397de036758.

* changed order of immer and devtools in tests

* added test for action with payload type in immer/devtools

* removed unnecessary test

* Update tests/middlewareTypes.test.tsx

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-08-19 07:10:50 +09:00
Spencer Adolph
f0b6023ece
Fix Persist in TypeScript Usage on readme (#1193)
* Fix Persist example in Typescript

Persist middleware requires the name option to keep storage unique.

See https://github.com/pmndrs/zustand/blob/main/docs/persisting-store-data.md#name

This change adds the 'name' option to the Typescript Usage example to update it.
Additionally, the persist example already has this required option.

* run prettier on file
2022-08-18 09:15:59 +09:00
Satvik Pendem
05da64cfe5
Fix grammar (#1163) 2022-08-02 15:19:31 +09:00
Daishi Kato
62edd67866
docs: add immutable state and merging doc (#1161)
* add a doc from wiki

* move createContext into docs

* fix a link

* fix(docs): add immutable state and merging doc

* change format
2022-08-01 23:48:43 +09:00
Daishi Kato
fa581ddd9b
fix(docs): useBoundStore instead of useStore (#1125)
* fix(docs): useBoundStore instead of useStore

* run prettier
2022-07-26 08:58:43 +09:00
Vikash
f07276c3f5
docs: 3d party libraries page added to docs (#1016)
* Home page of wiki added to docs 

Added home page to the docs directory

* Delete home.md

* 3d party libraries page is added 

3d party libraries page in wiki is now moved to docs directory

* Delete 3rd party libraries .md

* 3d party library page is added to docs

* lint issue with file name resolved

* rename

* run prettier

* fix readme

Co-authored-by: daishi <daishi@axlight.com>
2022-07-26 08:53:00 +09:00
Daishi Kato
8284334aa5
fix(docs): add a note for TS users and update links to docs (#1097)
* fix(docs): add a note for TS users and update links to docs

* keep "wiki page"
2022-07-18 18:22:14 +09:00
xlboy
d49dde827a
docs(readme): symbol supplement in code example (#1083)
* docs(readme): symbol supplement in code example

Located at `Reading/writing state and reacting to changes outside of components`
Supplement the ending symbol of the `Component` function

* docs(readme): unify the style of some code examples
2022-07-14 00:17:52 +09:00
Sepehr Safari
f8bc24edf0
docs: typo in readme.md (#1049)
Fixed typo "seperate" to "separate".
2022-07-03 20:53:00 +09:00
Daishi Kato
2b698fb249
chore: run prettier for docs (#1007) 2022-06-14 23:00:07 +09:00
InfiniteXyy
1011a2fa3c
chore(docs): fix typo in docs & code examples (#1006) 2022-06-14 22:06:44 +09:00
Devansh Jethmalani
72de1aed5d
Fix TS4023 and other minor changes (#940)
* fix(ts4023): use type aliases instead of interfaces

* refactor(types): immer, devtools
- make immer types more like devtools for better quickinfo
- make immer and devtools store names consistent with
  StoreMiddleware naming convention (eg StorePersist,
  StoreRedux, etc)

* format(docs): add a linebreak after <summary>
2022-04-29 23:15:55 +09:00
Daishi Kato
78ebd86f16
fix(readme): remove invalid typescript example (#923) 2022-04-20 08:48:13 +09:00
Daishi Kato
e30f4700c4
fix(docs): fix and improve readme (#917) 2022-04-18 17:19:03 +09:00
Daishi Kato
2a2c180c73
fix(middleware): separate immer middleware (#915) 2022-04-18 10:06:17 +09:00
Devansh Jethmalani
99cddcf76f
breaking(types): Add higher kinded mutator types (#725)
* imaginary code that uses uSES

* revert backward compatibility code as this is not going to be v4

* use use-sync-external-store

* revert to react 17

* handle error by our own

* v4.0.0-alpha.2

* fix&refactor a bit

* update uSES experimental package

* remove error propagation hack

* update size snapshot

* update uSES and add dts

* split react.ts and no export wild

* split useStore impl

* context to follow the new api, export wild again

* v4.0.0-alpha.3

* add missing await

* update uSES

* update uSES

* uses uSES extra!

* v4.0.0-alpha.3

* fix(types): Rename from UseStore to UseBoundStore

* breaking(types): drop deprecated UseStore type

* breaking(core): drop v2 hook compatibility

* breaking(middleware): drop deprecated persist options

* breaking(core): drop deprecated store.subscribe with selector

* update uSES

* fix update uSES

* v4.0.0-alpha.5

* combine subscribe type

* intentional undefined type

* add useDebugValue

* update uSES

* update uSES types

* breaking(middleware): make persist options.removeItem required

* update uSES

* v4.0.0-alpha.6

* fix(readme): remove memoization section which is no longer valid with uSES

* feat(readme): add new createStore/useStore usage

* update useSES

* update uSES and deps

* v4.0.0-alpha.7

* update uSES

* update uSES

* shave bytes

* vanilla: add higher kinded mutator types

* persist: add higher kinded mutator types

* persist: try to minimize diff

* use `PopArgument` in vanilla too

* update uSES

* use overloads instead of `createWithState`

* avoid symbols

* add new types to middlewares

* add new types react

* add new types to context

* fix persist types

* add immer

* migrate middleware type tests

* fix react type, export `UseBoundStore`

* migrate vanilla type tests

* rename `_createStore` to `createStoreImpl`

* Default to no mutations in `StateCreator`

* migrate context.test.tsx

* fix devtools.test.tsx type erros

* context: remove callsignature in useStoreApi

* context: remove `UseContextStore` type

* context: fix useBoundStore type

* context: keep `UseContextStore` for tooltip just don't export it

* react: remove duplicate overload in create

* export `WithPersist`

* devtools: preserve try/catch

* devtools: preserve window check

* add a test case for v3 style create

* devtools: preverse test fix from base branch

* remove StoreApiWithFoo types, don't export WithFoo types

* style

* devtools: preverse `originalIsRecording` change

* fix bug in devtools

* empty commit

* 4.0.0-beta.1

* fix lint

* style

* export immer fix tests

* style, minor fixes

* devtools: fix test

* Update tests/devtools.test.tsx

* breaking(middleware/devtools): use official devtools extension types

* type object.create

* avoid emitting @redux-devtools/extension

* fix type with any

* refactor

* fix yarn lock

* temporary fix #829

* v4.0.0-beta.2

* fix lint

* lock date-fns version

* test middleware subtyping

* fix errors in conflict resolution

* lock testing-library/react alpha version

* more correct (and strict) persist types

* migrate tests

* wip release notes

* fix devtools merge with base

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

* add a test case for persist with partialize option

* update readme

* fix lint

* immer: mutate `store.setState`

* fix devtools merge with base

* immer: fix mutations order

* changes in readme

* move and rename v4 migration md

* add `combine` usage in readme

* typos

* create separate md for typescript, add common recipes

* minor fixes

* devtools: minor type fix
(probably I copy pasted from persist and forgot to remove `U`)

* add more migrations

* context: fix import

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

* devtools: minor refactor
rearrange code for better diff

* fix lint: run prettier

* wip

* uSES rc.1

* getServerState for #886, no types yet

* uSES v1

* devtools: remove deprecations and warnings

* fix tests

* v4.0.0-beta.2

* wip

* migrate tests

* persist: keep diff minimal

* fix merge in package.json and yarn.lock

* fix merge for persist

* don't use `import type`

* docs(typescript): add slices pattern

* fix selector & equals types
for inference with useCallback, see issue #812

* add test for setState with replace

* remove undefined selector overload

* make immer more generic

* make devtools replace-friendly and more correctly typed

* migrate tests

* make setState bivariant to make the state covariant

* devtools: return the result of `setState`

* devtools: make the fallback branch in `StoreSetStateWithAction` bivariant too
(I forgot to make this bivaraint)

* remove strict replace

* fix lint

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-04-18 09:14:00 +09:00
Daishi Kato
a34649d35a
feat: use-sync-external-store (#550)
* imaginary code that uses uSES

* revert backward compatibility code as this is not going to be v4

* use use-sync-external-store

* revert to react 17

* handle error by our own

* v4.0.0-alpha.2

* fix&refactor a bit

* update uSES experimental package

* remove error propagation hack

* update size snapshot

* update uSES and add dts

* split react.ts and no export wild

* split useStore impl

* context to follow the new api, export wild again

* v4.0.0-alpha.3

* add missing await

* update uSES

* update uSES

* uses uSES extra!

* v4.0.0-alpha.3

* update uSES

* fix update uSES

* v4.0.0-alpha.5

* add useDebugValue

* update uSES

* update uSES types

* update uSES

* v4.0.0-alpha.6

* fix(readme): remove memoization section which is no longer valid with uSES

* feat(readme): add new createStore/useStore usage

* update useSES

* update uSES and deps

* v4.0.0-alpha.7

* update uSES

* update uSES

* shave bytes

* update uSES

* fix yarn lock

* temporary fix #829

* uSES rc.1

* getServerState for #886, no types yet

* uSES v1
2022-04-07 23:53:27 +09:00
Paras Sanghavi
fe06e13187
docs: Fix TypeScript docs for using subscribe with selector (#876) 2022-03-21 12:09:30 +09:00
daishi
9905f64786 fix(readme): update demo link #747 2022-01-12 07:40:35 +09:00
Omid Kashan
0aeaf7f050
docs: add note about using set() third param for logging (#712)
* docs: add note about using set() third param for logging

* docs: update readme with suggested changes for action type logging

* Update readme.md

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2021-12-23 09:35:12 +09:00
Oskar Skuteli
1242610103
Add missing import to ts example (#718) 2021-12-19 07:33:25 +09:00
Devansh Jethmalani
c3697e5251
Remove devtools prefixing from readme (#706) 2021-12-11 08:13:40 +09:00
Anatole Lucet
732edbc61f
docs: link persist full documentation in readme (#653) 2021-11-11 07:34:27 +09:00
Daishi Kato
8893495cee
fix(docs): typing with subscribeWithSelector middleware (#643) 2021-11-09 07:00:07 +09:00
Daishi Kato
6f95f128bf
fix(tests): add #632 example and improve middleware types tests (#633)
* fix(tests): add #632 example

* update #632 example in test

* update #632 example in test again

* add #631 example in test

* add a link to middleware type test in readme

* change/simplify middleware type test

* comment on same line

* fix: middleware test for single subscribeWithSelector

* empty commit

* link to immer reference implementation in readme

* update readme
2021-11-03 18:02:44 +09:00
drcmda
9f47fdc927
Update readme.md 2021-11-03 00:45:46 +01:00
daishi
784c6d480a fix readme to follow #603 2021-10-23 12:29:51 +09:00
Daishi Kato
37ff965563
feat(middleware): subscribeWithSelector middleware (#603)
* feat(middleware): subscribeWithSelector middleware, deprecating the core feature

* update readme

* update readme
2021-10-21 22:51:10 +09:00
benj-dobs
36d9312805
docs: Clarify that listeners added with subscribe are called synchronously (#602) 2021-10-21 22:08:39 +09:00
Dominik Dorfmeister
5edfe63510
docs: document that createContext can be used to initialize a store depending on props, and how to work with it in TypeScript (#553) 2021-09-03 08:31:49 +09:00
marcoSven
bbd3793328
Allow optional REDUX DEVTOOLS "options" object (#540)
* Allow optional REDUX DEVTOOLS "options" object

## Why is this change needed?
Unable to display Maps/Sets

## How does it address the issue?
optional serialize date, regex, undefined, nan, infinity,
error, symbol, map & set

## breaking change prev "prefix" option
prefix?: string -> options?: { name?: string }

https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#serialize

https://github.com/pmndrs/zustand/issues/249

* backward compatible with "prefix" store name option

* Update readme.md
2021-08-26 22:53:40 +09:00
Miguel Hernández
16736c917f
fix(readme): ts example of immer middleware (#509)
* fix(readme): ts example of immer middleware

* Update readme.md

Co-authored-by: Miguel Hernández <miguel.hernandez@azeti.net>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2021-07-24 07:02:16 +09:00
Daishi Kato
b56ae712a9
Update readme.md 2021-07-23 18:14:36 +09:00