1236 Commits

Author SHA1 Message Date
Yasin
b1648f7ea2
doc: added zustand-computed-state to external libraries (#2598) 2024-06-13 16:45:05 +09:00
Mayank
7c156014bc
doc: added treeshakable to external libraries (#2595)
* doc: added treeshakable to external libraries

* format with prettier
2024-06-10 20:43:30 +09:00
Sunil
3b90e1c902
update: example/demo (#2585)
* update: example/demo

- fix eslint config and lint issues
- fix react key issue
- remove children passed as props
- remove unused variables and imports
- "encodings_fragment" is deprecated, replaced it with "colorspace_fragment"

* update: remove --fix
2024-06-06 22:44:17 +09:00
Daishi Kato
88ef3407ee
chore(deps): update dev dependencies (#2582)
* chore(deps): update dev dependencies

* empty commit
2024-06-05 11:04:35 +09:00
daishi
018358ce7e prefer npm-stat 2024-05-28 20:55:57 +09:00
Daishi Kato
6750ac19c9
chore: publish workflow (#2569)
* chore: publish workflow

* trigger with release

* fix
2024-05-27 21:10:53 +09:00
Daishi Kato
92a340a31a
chore(deps): update dev dependencies (#2565)
* chore(deps): update dev dependencies

* update react@rc
2024-05-22 09:25:21 +09:00
Juliette Lamarche
97d112ce54
docs: add @prncss-xyz/zustand-optics to third party libraries (#2564)
* docs: add @prncss-xyz/zustand-optics to third party libraries

* fix: typo

sorry!
2024-05-21 08:00:13 +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
Daishi Kato
6d6383054f
Migrate to pnpm (#2545)
* migrate to pnpm

* some fixes

* simplify

* some more adjustments
2024-05-12 14:43:45 +09: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
✦ freddie
e74fdc8bc9
docs: add zustand-context to third party libs (#2525)
* docs: add zustand-context to third party libs

* docs: typo

* docs: sort alphabetically
2024-05-01 23:06:17 +09:00
Henpai Hsu
b66ccd5243
docs: update ramda example (#2510) 2024-04-26 17:07:15 +09:00
Daishi Kato
bdd104a97d
docs: add zustand-slices (#2494) 2024-04-19 04:15:13 -05: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
Daishi Kato
e00c69f82b
chore: old ts versions to test in ci (#2469) 2024-04-07 20:41:09 +09:00
Daishi Kato
d57072caf5
update vitest (#2462)
* update vitest

* use resolve

* patch for older ts

* for older ts

* hack with any

* for other builds

* wip: for umd

* Revert "wip: for umd"

This reverts commit a5c0d6beaa80cbbdcad7961b77d593effd6a83c8.

* wip: esm

* wip: system

* Revert "wip: system"

This reverts commit aa919631a94a5b321fa9f2ec6c26b826c37ca3b0.

* wip: umd

* wip: hack cjs

* system cannot be tested
2024-04-06 20:48:21 +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
Daishi Kato
bd5d66fc00
Create FUNDING.json 2024-03-15 10:43:21 +09:00
Daishi Kato
c092d76260
chore(tests): suppress expected warnings (#2398) 2024-03-09 08:51:05 +09:00
daishi
6f61b76fa0 4.5.2 v4.5.2 2024-03-02 11:35:36 +09:00
Daishi Kato
96d6bb2ae9
chore(deps): update dev dependencies (#2379) 2024-03-02 11:33:31 +09:00
Daishi Kato
453b3a65f8
build: target es2018 (#2361) 2024-03-02 11:26:23 +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
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
Ekin Dursun
41924df88f
refactor: Use for..of instead of C-style for (#2374) 2024-02-29 23:18:47 +09:00
Ekin Dursun
16b0ebf1b1
Enable usage of Corepack (#2366)
Corepack chooses package manager to use with the
field `packageManager`. For users using Yarn
through Corepack, this is a real convenience.

Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
2024-02-29 10:07:16 +09:00
Carsten Dietzel
827d5aacaf
Fix typo in prevent-rerenders-with-use-shallow.md (#2364) 2024-02-29 00:08:07 +09:00
Ankit Sagar
3c6dc2d12b
updated getting-started doc with more examples (#2348)
* updated readme with more examples

* moved example to docs from readme

* formatted code with Prettier

---------

Co-authored-by: Ankit Sagar <ankit.sagar@telnesstech.com>
2024-02-22 23:47:36 +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
daishi
6109bc3bd0 4.5.1 v4.5.1 2024-02-17 11:06:53 +09:00
Daishi Kato
e174cc8910
chore(deps): update dependencies (#2345) 2024-02-17 11:05:36 +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
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
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