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
Charles Kornoelje
27bffb1fba
docs(persist): add info about createJSONStorage helpful function ( #2299 )
...
* first pass at docs
* add jump-to-section
2024-01-20 14:17:05 +09:00
daishi
13830c1134
4.5.0
v4.5.0
2024-01-20 10:22:48 +09:00
Daishi Kato
d12b4fb13d
chore(deps): update dev dependencies ( #2297 )
...
* chore(deps): update dev dependencies
* fix lock file
2024-01-20 10:22:24 +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
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
Jaekook Brian Lee
517524d2b0
Adding Zusty (zustand dev tool) to the third party libraries ( #2267 )
...
* Update third-party-libraries.md
Adding zustand dev tool made by oslabs to the third party libraries.
* Update third-party-libraries.md
changed to alphabetical order
* Update third-party-libraries.md
formatted with prettier/which got rid of the extra space on line 17
2023-12-22 09:15:44 +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
Charles Kornoelje
9baf0a5d38
chore(test): stop testing deprecated features and test subscribe in vanilla ( #2244 )
...
* chore(test): update test to stop testing deprecated features
* chore(test): add subscribe test for zustand/vanilla
* chore(test): only verify that subscribe exists on `create`
* chore(test): switch type of test
2023-12-13 00:46:50 +09:00
Younghoo Kim
662f38a8c3
docs(immer): change demo url ( #2239 )
2023-12-11 21:34:35 +09:00
Jonathan Bodling
fa04478ab2
chore(immer): fix security issue ( #2228 )
2023-12-10 08:31:43 +09:00
Charles Kornoelje
19960f6d96
docs(contributing): update test command ( #2234 )
2023-12-09 13:39:25 +09:00
daishi
50a8677dba
4.4.7
v4.4.7
2023-11-28 09:26:24 +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
ADTC
f5561dfb05
Add a warning to readme about React Server Components ( #2202 )
...
* Add a warning to readme about React Server Components
For more information, see https://github.com/pmndrs/zustand/discussions/2200
* Use a softer, more succinct, formally worded warning
---------
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-11-25 00:01:24 +09:00
Geofrey Isiagi - Full-stack Web / Cloud Developer
a7b57b24d5
Update introduction.md ( #2208 )
...
* Update introduction.md
Adds Bun in the installation commands.
* Update docs/getting-started/introduction.md
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
---------
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2023-11-23 00:47:27 +09:00
Daishi Kato
9857a676a9
refactor: revisit prettier config to be minimal ( #2193 )
2023-11-14 12:19:51 +09:00
daishi
a836356b5e
4.4.6
v4.4.6
2023-11-03 08:55:18 +09:00
Danilo Britto
efc8f68142
Update export types ( #2170 )
...
* Use export types
* Update package.json
* Update package exports
* Revert publint changes
* Apply publint recommendations to inner packages
2023-11-03 08:54:20 +09:00
Rustam
c500f70cbb
fix(docs): add missing param in mocked create (Vitest guide) ( #2166 )
2023-11-01 23:25:51 +09:00
권신학
492637a880
docs: update documentation of persist ( #2147 )
...
* docs: update documentation of persist
Add superjson serialization/deserialization example to Zustand persist documentation
* docs: fix spelling documentation of persist
* docs: Apply feedback by moving content under custom storage engine and specifying that the code is an example
* docs: Update variable name to example name and separate storage as const
2023-11-01 10:35:03 +09:00
daishi
e138de70bb
4.4.5
v4.4.5
2023-10-31 23:26:12 +09:00
Daishi Kato
5ec9c0d83b
chore(deps): update dev dependencies ( #2162 )
2023-10-31 23:25:36 +09:00
Danilo Britto
91157db382
Apply publint recommendations ( #2157 )
...
* Apply publint recommendations
* Minor changes
* Minor changes
* Minor changes
2023-10-31 23:14:49 +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
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
daishi
93c8ca5647
4.4.4
v4.4.4
2023-10-21 22:58:18 +09:00
Daishi Kato
a67bc24839
chore(deps): update dev dependencies ( #2134 )
2023-10-21 22:57:14 +09:00
Daishi Kato
4abacb29af
fix(build): patch entry points zustand/shallow for CJS ( #2128 )
2023-10-21 22:33:20 +09:00
Daishi Kato
55ad02b375
fix(readme): avoid deprecated/misleading usage ( #2132 )
2023-10-21 22:32:52 +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
daishi
90915ad1b8
4.4.3
v4.4.3
2023-10-05 23:17:07 +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
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