785 Commits

Author SHA1 Message Date
daishi
79782c3ba3 4.0.0-rc.0 v4.0.0-rc.0 2022-04-18 10:39:54 +09:00
Daishi Kato
8e700e0c48
chore(deps): update dev dependencies (#916) 2022-04-18 10:34:36 +09:00
M. Bagher Abiat
279bfb1e64
fix(middleware/devtools): add enabled option and show devtools warning only if enabled (#880)
* remove warning

* test

* rfc: enabled option

* debug

* update

* update

* [DEV-ONLY]

* [DEV-ONLY]

* let enable enabled

* let's enable enabled

* lint

* Update src/middleware/devtools.ts

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

* add tests for different cases

* refactor test

* fix test

* tweak mock in test

* fix merge main

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-04-18 10:20:21 +09:00
Daishi Kato
2a2c180c73
fix(middleware): separate immer middleware (#915) 2022-04-18 10:06:17 +09:00
Daishi Kato
c32a188c02
fix(index): export createStore from vanilla (#914) 2022-04-18 09:24:53 +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
76eeacb1c4
fix(build): separate vanilla build (#904) 2022-04-17 08:47:26 +09:00
daishi
ee1013a3aa restore resolutions for stable codesandbox ci 2022-04-11 16:46:54 +09:00
Devansh Jethmalani
943af082ae
breaking(middleware/devtools): remove deprecations and warnings (#892)
* 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

* update uSES

* 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

* lock testing-library/react alpha version

* devtools: remove deprecations and warnings

* fix tests

* use `__DEV__`

* revert irrelevant v4 changes

* correct merge

* fix test

* fix `any`

* fix `any` again

Co-authored-by: daishi <daishi@axlight.com>
2022-04-09 02:27:28 +09:00
Daishi Kato
f65a25acd5
breaking(middleware/devtools): use official devtools extension types (#819)
* breaking(middleware/devtools): use official devtools extension types

* type object.create

* avoid emitting @redux-devtools/extension

* fix type with any

* refactor

* lock date-fns version

* refactor
2022-04-07 23:58:55 +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
Daishi Kato
34bf82bf27
breaking(types): drop deprecated UseStore type (#596)
* fix(types): Rename from UseStore to UseBoundStore

* breaking(types): drop deprecated UseStore type

* empty commit
2022-04-07 23:47:58 +09:00
Daishi Kato
c99bbcd4ad
breaking(core): drop v2 hook compatibility (#597) 2022-04-07 23:45:57 +09:00
Daishi Kato
8c8f693999
breaking(middleware): drop deprecated persist options and make removeItem required (#598)
* breaking(middleware): drop deprecated persist options

* breaking(middleware): make persist options.removeItem required
2022-04-07 23:43:39 +09:00
Daishi Kato
eadb81f9c6
breaking(vanilla): drop deprecated store.subscribe with selector (#604)
* breaking(core): drop deprecated store.subscribe with selector

* combine subscribe type

* intentional undefined type
2022-04-07 23:38:24 +09:00
daishi
4d8003b363 3.7.2 v3.7.2 2022-04-07 23:03:30 +09:00
Daishi Kato
8637ec6a03
chore(deps): update dev dependencies (#897)
* chore(deps): update dev dependencies

* remove resolution
2022-04-07 23:03:00 +09:00
zerofirework
5eaffff315
fix(middleware/persist): Merge storage value with the latest store state (#894)
* Merge storage value with the latest store state

When using zustand store with Provider and Context, it's possible to mutate the store state in an useEffect callback before hydration  creates `stateFromStorage`. It should merge the storage value with the latest store state instead of the config result since it can be out of date.

* fix tests

* Add test

* commit

Co-authored-by: Zero Liu <zerolxy@gmail.com>
2022-04-07 22:41:00 +09:00
Daishi Kato
3acbb359a6
Update FUNDING.yml 2022-03-22 20:41:51 +09:00
Daishi Kato
0bf1ec1282
Create FUNDING.yml 2022-03-22 20:39:00 +09:00
Paras Sanghavi
fe06e13187
docs: Fix TypeScript docs for using subscribe with selector (#876) 2022-03-21 12:09:30 +09:00
daishi
da781a2577 lock testing-library/react alpha version 2022-03-05 10:05:28 +09:00
daishi
ab82143ff0 lock date-fns version 2022-03-04 11:32:23 +09:00
daishi
a715e140dd 3.7.1 v3.7.1 2022-02-28 11:36:57 +09:00
Daishi Kato
160459fda1
chore(deps): update dev dependencies (#833) 2022-02-28 11:36:18 +09:00
Daishi Kato
a46f1fd871
fix(middleware/devtools): deprecate serialize.options (#828) 2022-02-28 11:12:44 +09:00
Devansh Jethmalani
52cc17a9fd
fix(context): revert removing overloads in UseContextStore (#817)
* fix(context): revert removing overloads in `UseContextStore`

Fixes #812

* add test

* fix lint
2022-02-28 10:52:25 +09:00
daishi
0fce3a9e74 3.7.0 v3.7.0 2022-02-11 08:37:02 +09:00
Daishi Kato
05094baa55
chore(deps): update dev dependencies (#793) 2022-02-11 08:35:28 +09:00
Devansh Jethmalani
a418fd7480
Migrations regarding higher kinded mutators for v4 (#772)
* add `Mutate` for migration path

* deprecate `PartialState`

* deprecate `StateSliceListener`

* add v4 version of `UseContextStore` for migration

* revert and deprecate `UseContextStore`

* subscribeWithSelector: fix deprecation message, add a test case

* subscribeWithSelector: fix overloads

* persist: deprecate `StoreApiWithPersist`

* subscribeWithSelector: update deprecation message

* redux: deprecate `StoreApiWithRedux`

* devtools: deprecate `StoreApiWithDevtools`

* migrate middleware tests

* update deprecation message to mention test file

* style

* don't export `WithPersist`
2022-02-11 08:23:24 +09:00
Daishi Kato
5b938fbbff
feat(build): use __DEV__ to control development mode (#789)
* feat(build): use __DEV__ to control development mode

* fix workflow

* missing env in systemjs build
2022-02-10 08:45:43 +09:00
Todd Williams
e90e8bc7b6
match vanilla StateCreator type in middleware/subscribeWithSelector (#787)
* match vanilla StateCreator type

Match
0ba3c24007/src/vanilla.ts (L50-L52)
to make subscribeWithSelector more useful with custom states.

Ran into this when trying to use subscribeWithSelector with
custom middleware that uses immer's WritableDraft on SetState

* apply changes for all middleware

Co-authored-by: Todd Williams <twilliams5@snapchat.com>
Co-authored-by: daishi <daishi@axlight.com>
2022-02-10 08:32:15 +09:00
Devansh Jethmalani
1b2560f25f
fix(devtools): don't show jsdoc deprecation warning when no options are passed (#781) 2022-02-10 08:31:38 +09:00
Daniel Power
0ba3c24007
chore(examples): Refactor demo code to reduce distraction from Zustand usage (#751)
* Refactor demo code to reduce distraction from Zustand usage

* Update examples/src/components/Details.js

* Update examples/src/components/Details.js

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2022-01-13 12:23:29 +09:00
daishi
9905f64786 fix(readme): update demo link #747 2022-01-12 07:40:35 +09:00
daishi
fba3bc799a fix(examples): fix build 2022-01-12 00:23:21 +09:00
daishi
50af477055 3.6.9 v3.6.9 2022-01-10 23:15:58 +09:00
Rômulo Rocha de Oliveira
e7bdbc4341
fix(build): Generate umd and system files (#740)
* add new config in rollup to generate new files: umd and system

* add new config in rollup to generate new files: umd and system

* Added new config to compile to SystemJS module

* added createSystemConfig to the config section array

* addressing feedbacks: fixing config for umd and system

Co-authored-by: Romulo <romulo.rocha@trio.dev>
Co-authored-by: Thyago Weber <thyago.weber@gmail.com>
2022-01-10 23:08:11 +09:00
daishi
1dce3d2f14 3.6.8 v3.6.8 2021-12-24 16:29:04 +09:00
Daishi Kato
19d9cf0ee4
chore(deps): update dependencies (#732) 2021-12-24 16:25:49 +09:00
Devansh Jethmalani
2ddbd76a2c
devtools: deprecate passing name directly instead of an object (#731) 2021-12-24 16:10:36 +09:00
Daishi Kato
5b3b963181
fix(middleware): revert devtools extension connector with try-catch (#724)
* fix(middleware): revert devtools extension connector with try-catch

* add a test case

Co-authored-by: Devansh Jethmalani <devanshj@users.noreply.github.com>
2021-12-24 16:09:46 +09:00
Devansh Jethmalani
cb99a36c59
devtools: minor fixes (#720) 2021-12-23 10:03:07 +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
daishi
48d4dc1d4f 3.6.7 v3.6.7 2021-12-07 16:31:57 +09:00
Daishi Kato
927c0eba8c
chore(deps): update dependencies (#700) 2021-12-07 16:31:23 +09:00
Daishi Kato
c54d1df87b
fix(middleware): devtools work in non-browser (#693)
* fix(middleware): devtools work in non-browser

* early return

* add a test

Co-authored-by: Devansh Jethmalani <devanshj@users.noreply.github.com>
2021-12-07 16:06:41 +09:00
Mathis Møller
d89e7c5f32
Fix Jest line reporting (#690) 2021-12-04 07:45:05 +09:00