246 Commits

Author SHA1 Message Date
Wonsuk Choi
5bc717b663
refactor(middleware): replace export * with explicit named and type exports (#3151)
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-06-23 12:41:54 +09:00
Vladimir Chirikov
ca08a5ebf9
perf(devtools): avoid inferring action type when explicit action name is provided (#3147)
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-06-23 12:17:41 +09:00
Ali Mert Çakar
670b60e19a
feat(devtool): inferred action type (#2987)
* feat(devtools middleware) add automatic action name finding

* docs(readme) add inferActionName example

* feat: update readmes

* feat: update devtools middleware and tests

* feat: remove inferActionName

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
2025-05-21 20:12:14 +09:00
2yunseong
5df8085b0b
refactor: remove unnessary type assertion (#3113)
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-05-21 09:52:37 +09:00
Hong-Kuan Wu
b4177b3172
feat: add devtools.cleanup() method (#3111)
* feat(devtools): add cleanup method

* docs(devtools): add cleanup section

* reduce lines

* test(devtools): test if the connection removed after cleanup

---------

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-05-21 09:49:59 +09:00
Danilo Britto
a56a3e4bde
feat(vanilla): update shallow compare function and tests (#3108)
* feat(vanilla): update shallow compare function and tests

* prefer Object.getPrototypeOf

* docs: update shallow docs

* feat: minor fixes

---------

Co-authored-by: daishi <daishi@axlight.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-05-21 09:46:37 +09:00
Wonsuk Choi
028909eafa
chore(eslint): enforce file extension usage for internal modules, ignore external packages (#3116)
* chore(eslint): enforce file extension usage for internal modules, ignore external packages

* chore(*): apply the updated ESLint rules to the relevant files
2025-05-10 22:45:58 +09:00
shinhyogeun
c72ac92764
remove duplicated type declaration (#2982)
Co-authored-by: kenny-io <kenny.io@kakaoenterprise.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2025-05-02 08:15:12 +09:00
Wonsuk Choi
a1c7f1c20f
refactor(middleware): rename argument names like 'a', 'f' (#3032)
* refactor(middleware): rename argument name 'a' to 'arg' or 'args'

* refactor(middleware): rename argument name 'f' to 'fn'

* refactor(middleware/devtools.ts): rename argument name 'arg0' to 'args'
2025-02-28 17:53:30 +09:00
Wonsuk Choi
8ced2719ac
refactor(middleware/combine.ts): change exported function to 'function declaration' (#3030) 2025-02-27 20:43:35 +09:00
Daishi Kato
6eff6e7eec
chore(deps): update dev dependencies (#2944) 2025-01-07 23:17:07 +09:00
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
Danilo Britto
9bae06922a
fix(persist): fix async migrate on persist middleware (#2877)
* fix(perist): add support for async migrate on persist middleware

* feat(vitest): rename vitest.config.ts to vitest.config.mts

* fix: fix minor issues

* fix: fix minor issues

* feat: minor changes

* feat: revert vitest changes

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2024-12-04 22:06:36 +09:00
Andy Zhou
af7ff21190
fix(middleware): devtools type error #2700 (#2875)
* fix: add an inferred generic U to CreateStoreImpl

* fix: add inferred generic U variables to both Devtools and DevtoolsImpl

* test: add tests for issue #2700

* revert impl types

* code styling

---------

Co-authored-by: daishi <daishi@axlight.com>
2024-12-04 22:00:01 +09:00
Daishi Kato
9525f9264d
fix(shallow): iterable-like insensitive keys order comparison (alternate implementation) (#2821)
* alternate implementation for shallow

* test with pure iterable

* refactor

* another refactor

---------

Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
2024-10-30 20:52:43 +09:00
Daishi Kato
259c19ff2d
fix(shallow): fallback map-like iterator comparison (#2795)
* add failing test

* add a fallback
2024-10-27 16:38:59 +09:00
Daishi Kato
c08adc2a47
revert useShallow refactor in #2701 (#2703) 2024-09-15 11:19:05 +09:00
Daishi Kato
2cadf6511d
refactor useShallow (#2701) 2024-08-27 10:13:01 +09:00
Christian van der Loo
d7345da7cf
Fix Immer type inference for setState (#2696)
* fix(immer): tweak type inference to base `setState` type off of store `setState` instead of `getState`

* fix(immer): instead, infer type directly from StoreApi<T>["setState"]

* fix(immer): instead of using `StoreApi`, extract from A2 the non-functional component of state

* docs: add comment describing why it is not derived from `A1`

* test: add example middleware that modifies getState w/o setState

* fix: add assertion for inner `set` and `get` types

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2024-08-27 10:10:47 +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
Daishi Kato
a00f3fa1ff
chore(deps): update dependencies (#2680) 2024-08-15 11:13:14 +09:00
Double Thinker
dad36416dc
fix(storage): avoid calling setItem with the state just retrieved (#2678) 2024-08-15 10:50:06 +09:00
Kevin Ingersoll
a262c9f1f3
useStore uses ReadonlyStoreApi (#2586)
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2024-06-26 12:24:08 +09:00
bobdepreziz
9cb1c67827
fix: return type of persist migrate function changed to PersistedState (#2360)
Co-authored-by: Bob Deprez <bob.deprez@zf.com>
2024-03-02 11:16:00 +09:00
Ekin Dursun
41924df88f
refactor: Use for..of instead of C-style for (#2374) 2024-02-29 23:18:47 +09:00
Daishi Kato
a85865b4b8
chore: clarify deprecation message (#2337) 2024-02-17 10:40:52 +09:00
Rafael Baldasso Audibert
7d2525efdb
refactor: Relax types for persist middleware (#2332)
Right now, we're requiring new `StateStorage` implementations to forcefully return `void` from inside `setItem` and `removeItem`.

When using a library that returns the set value for `setItem` or `removeItem`, therefore returning  a `string`, it causes Typescript to fail, requiring some weird workarounds.

For example, when using `localforage` (https://github.com/localForage/localForage) one needs to do what we describe below. Notice the `void` keyword.

```typescript
const storage: StateStorage = {
   ...localForage,
   setItem: void localForage.setItem.bind(localForage)
}
```

Another, longer, alternative is

```typescript
const storage: StateStorage = {
   ...localForage,
   // Curly braces are required because we need to "return `void`"
   setItem: (name, value) => {
       localStorage.setItem(name, value)
  }
}
```

By changing the type implementation to ignore types - using unknown - we can simply use `localforage` - and similar libraries - as if we were using `window.localStorage`
2024-02-17 10:39:06 +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
Charles Kornoelje
43a2b11ad9
fix: Add deprecation notice for getServerState() in WithReact type (#2266) 2024-01-20 09:37:19 +09:00
Dominik Dorfmeister
740033cf31
feat: getInitialState (#2277)
* feat(react): implement getServerState by closing over the defaultState

serverState will be used by react on the first client render; this should avoid hydration mismatches when combined with the persist middleware, which can change the state between the SSR and the first CSR

* define getServerState in vanilla.ts

* feat: implement getServerResult in persist middleware

this avoids hydration errors when state is restored from e.g. localstorage synchronously

* feat: capture initialState for getServerState in react

this avoids hydration mismatches when updates happen to the store state between ssr and csr

* refactor: revert changes to oldImpl

* fix: make selector default to identity function

if we default to `api.getState`, we will always read the client snapshot if there is no selector passed. An identity function returns its argument, which is either the snapshot (api.getState) or the server snapshot (api.getServerState)

* define getInitialState in vanilla

* revert WithReact

* fix them

* fix test

* oops, fix another test too

* forgot to use identity

* test: add a test for hydration errors

* fix(readme): imply getInitialState is a public api

---------

Co-authored-by: daishi <daishi@axlight.com>
2024-01-20 09:05:58 +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
Daishi Kato
9857a676a9
refactor: revisit prettier config to be minimal (#2193) 2023-11-14 12:19:51 +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
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
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
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
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
Daishi Kato
5777a65cf5
chore(deps): update dev dependencies (#1965) 2023-08-01 10:42:18 +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
Laurenz Honauer
630ba1a3e4
feat(middleware/persist): improve createJSONStorage for Maps (#1763)
* feat: add support for Maps to persist middleware

* refactor: change createJsonStorage to accept custom reviver/replacer

* refactor: map support code review
2023-05-04 12:55:59 +09:00
Daishi Kato
f37530fc3d
chore: add extentsion in imports (#1678)
* chore: add extentsion in imports

* fix github workflow

* revert for zustand/context

* do not patch :)

* fix workflow file

* update ts 5

* patch tsconfig

* use old typescript for react 16

* downlevel-dts to 3.8

* Revert "downlevel-dts to 3.8"

This reverts commit d03e5266e14146ed4a7c92e8a5cd2cb295727f69.

* patch workflow file

* patch for react 16

* remove ts3.4 in workflow

* skipLibChecks

* revert changes in test-multiple-versions.yml

* fix sed

* wip: add allowJs

* Revert "wip: add allowJs"

This reverts commit fca34d7d2decc1e469a733224f7680ab37792dc8.

* use ts 495

* useESM false

* Revert "useESM false"

This reverts commit 07a91d8acb14bc5839013aad47d0606dec312d62.

* no coverage

* no coverage 2

* no coverage 3

* wip

* disable transform

* revert a change

* revert changes

* test: try ignoring tests with dynamic imports

* test: skip tests that require/tests modules in isolation

* test: remove dynamic import

* run skipped tests on CI

* test: add new devtools imports to ci-only tests

* revert CI-ONLY-* hack

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* wip: workaround for react 16

* CI-MATRIX- for devtools CI hacks

* test: add env variable to test multiple builds workflow

* hack await import

* hack await import for another one

* wip: experimenting workflow file

* wip: experimenting workflow file

* wip: experimenting workflow file

* use different env name

* wip: experimenting workflow file

* do not use two envs

* revert to NODE_ENV

---------

Co-authored-by: Arjun <14841132+arjunvegda@users.noreply.github.com>
2023-05-02 06:28:46 +09:00
coffeebeats
f54469551f
fix(middleware/persist): ensure argument for onRehydrateStorage and onHydrate is defined on first hydration (#1692)
* add tests ensuring that onRehydrateStorage is always passed the latest state

* fix persist to always pass latest state to onRehydrateStorage and onHydrate listeners

* document that tests for onHydrate during first hydration are not possible

* ensure state updates during onHydrate are reflected in onRehydrateStorage callback

* undo modifications to persist's old implementation
2023-03-31 22:11:17 +09:00
coffeebeats
309c672fb7
fix(middleware/persist): ensure persist does not drop updates in onRehydrateStorage when using a synchronous storage API (#1689)
* document a potential issue with stale state being passed to 'onRehydrateStorage'

* fix an issue where state updates during 'onRehydrateStorage' were overwritten with sync storage reads

* add tests ensuring updates during the 'onRehydrateStorage' hook are handled correctly

* Update tests/persistSync.test.tsx

* Apply suggestions from code review

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-03-31 22:06:38 +09:00
George Manning
38c905564c
feat(middleware/persist): add skip hydration option #405 (#1647)
* add manual hydration option to persist middleware

* rename variable, update jsdoc, remove from oldImpl

* add tests for persist skipHydration

* add docs

* Update docs/integrations/persisting-store-data.md

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

* Update docs/integrations/persisting-store-data.md

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

* Update src/middleware/persist.ts

---------

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
Co-authored-by: Blazej Sewera <code@sewera.dev>
2023-03-31 20:20:16 +09:00
Yuri Sulyma
e6a99c5c05
fix: typo in shallow.ts (#1667) 2023-03-06 14:01:45 +09:00
Luke Murray
4517fed815
fix(react, types): relax react types (#1589)
* relax react types

* make react types more flexible
2023-03-06 13:59:47 +09:00