zustand
zustand copied to clipboard
v5
- [x] drop default exports #2238
- [x] drop deprecated features #2235
- [x] make React 18 as minimal requirement #2236
- [x] make use-sync-external-store a peer dependency #2237 #2301 #2302
- [x] make TS version requirement and tests in CI precise (follow Jotai) #2257
- [x] drop "module" condition (follow Jotai) #2270
- [x] use
"./*"in package.json exports and change Node.js requirement #2272 - [x] drop UMD/SystemJS builds and simplify build configs #2287
- [x] drop getServerState #2300
- [x] separate react entry point #2303
- [x] drop es5 #2380 #2433
- [x] #2395
- [x] #2427
- [x] #2466
- [x] write v5 migration guide
- [x] #2580
The latest updates on your projects. Learn more about Vercel for Git âī¸
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| zustand-demo | â Ready (Inspect) | Visit Preview | đŦ Add feedback | Aug 16, 2024 0:34am |
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Size Change: -48.8 kB (-80.05%) đ
Total Size: 12.2 kB
| Filename | Size | Change | |
|---|---|---|---|
./dist/context.js |
0 B | -789 B (removed) | đ |
./dist/esm/context.js |
0 B | -608 B (removed) | đ |
./dist/esm/context.mjs |
0 B | -612 B (removed) | đ |
./dist/esm/index.js |
0 B | -739 B (removed) | đ |
./dist/esm/index.mjs |
64 B | -686 B (-91.47%) | đ |
./dist/esm/middleware.js |
0 B | -3.95 kB (removed) | đ |
./dist/esm/middleware.mjs |
3.56 kB | -405 B (-10.23%) | đ |
./dist/esm/middleware/immer.js |
0 B | -210 B (removed) | đ |
./dist/esm/react/shallow.js |
0 B | -464 B (removed) | đ |
./dist/esm/react/shallow.mjs |
267 B | -197 B (-42.46%) | đ |
./dist/esm/shallow.js |
0 B | -499 B (removed) | đ |
./dist/esm/shallow.mjs |
82 B | -426 B (-83.86%) | đ |
./dist/esm/traditional.js |
0 B | -424 B (removed) | đ |
./dist/esm/traditional.mjs |
416 B | -8 B (-1.89%) | |
./dist/esm/vanilla.js |
0 B | -653 B (removed) | đ |
./dist/esm/vanilla.mjs |
403 B | -259 B (-39.12%) | đ |
./dist/esm/vanilla/shallow.js |
0 B | -355 B (removed) | đ |
./dist/esm/vanilla/shallow.mjs |
550 B | +195 B (+54.93%) | đ |
./dist/index.js |
244 B | -662 B (-73.07%) | đ |
./dist/middleware.js |
3.56 kB | -923 B (-20.57%) | đ |
./dist/middleware/immer.js |
229 B | -99 B (-30.18%) | đ |
./dist/react/shallow.js |
282 B | -804 B (-74.03%) | đ |
./dist/shallow.js |
189 B | -944 B (-83.32%) | đ |
./dist/system/context.development.js |
0 B | -689 B (removed) | đ |
./dist/system/context.production.js |
0 B | -388 B (removed) | đ |
./dist/system/index.development.js |
0 B | -918 B (removed) | đ |
./dist/system/index.production.js |
0 B | -432 B (removed) | đ |
./dist/system/middleware.development.js |
0 B | -4.09 kB (removed) | đ |
./dist/system/middleware.production.js |
0 B | -2.66 kB (removed) | đ |
./dist/system/middleware/immer.development.js |
0 B | -292 B (removed) | đ |
./dist/system/middleware/immer.production.js |
0 B | -188 B (removed) | đ |
./dist/system/react/shallow.development.js |
0 B | -564 B (removed) | đ |
./dist/system/react/shallow.production.js |
0 B | -387 B (removed) | đ |
./dist/system/shallow.development.js |
0 B | -545 B (removed) | đ |
./dist/system/shallow.production.js |
0 B | -330 B (removed) | đ |
./dist/system/traditional.development.js |
0 B | -536 B (removed) | đ |
./dist/system/traditional.production.js |
0 B | -361 B (removed) | đ |
./dist/system/vanilla.development.js |
0 B | -694 B (removed) | đ |
./dist/system/vanilla.production.js |
0 B | -325 B (removed) | đ |
./dist/system/vanilla/shallow.development.js |
0 B | -427 B (removed) | đ |
./dist/system/vanilla/shallow.production.js |
0 B | -309 B (removed) | đ |
./dist/traditional.js |
430 B | -42 B (-8.9%) | â |
./dist/umd/context.development.js |
0 B | -894 B (removed) | đ |
./dist/umd/context.production.js |
0 B | -561 B (removed) | đ |
./dist/umd/index.development.js |
0 B | -1.03 kB (removed) | đ |
./dist/umd/index.production.js |
0 B | -557 B (removed) | đ |
./dist/umd/middleware.development.js |
0 B | -4.63 kB (removed) | đ |
./dist/umd/middleware.production.js |
0 B | -2.99 kB (removed) | đ |
./dist/umd/middleware/immer.development.js |
0 B | -483 B (removed) | đ |
./dist/umd/middleware/immer.production.js |
0 B | -341 B (removed) | đ |
./dist/umd/react/shallow.development.js |
0 B | -1.22 kB (removed) | đ |
./dist/umd/react/shallow.production.js |
0 B | -883 B (removed) | đ |
./dist/umd/shallow.development.js |
0 B | -1.24 kB (removed) | đ |
./dist/umd/shallow.production.js |
0 B | -874 B (removed) | đ |
./dist/umd/traditional.development.js |
0 B | -650 B (removed) | đ |
./dist/umd/traditional.production.js |
0 B | -464 B (removed) | đ |
./dist/umd/vanilla.development.js |
0 B | -828 B (removed) | đ |
./dist/umd/vanilla.production.js |
0 B | -426 B (removed) | đ |
./dist/umd/vanilla/shallow.development.js |
0 B | -1.12 kB (removed) | đ |
./dist/umd/vanilla/shallow.production.js |
0 B | -838 B (removed) | đ |
./dist/vanilla.js |
416 B | -295 B (-41.49%) | đ |
./dist/vanilla/shallow.js |
562 B | -421 B (-42.83%) | đ |
./dist/esm/react.mjs |
333 B | +333 B (new file) | đ |
./dist/react.js |
353 B | +353 B (new file) | đ |
âšī¸ View Unchanged
| Filename | Size |
|---|---|
./dist/esm/middleware/immer.mjs |
210 B |
Maybe consider changing React Snowpack to React Vite on CodeSandbox?
I think you can just add it, if you are talking about .codesandbox/ci.json.
Feel free to open a PR to the main branch.
I don't know if the container sandbox is already supported.
I'll see if I've got some time in the nearest future :)
I'm a noob learning things and asking around.
I noticed many libraries dropping default exports. may I ask why?
@TheMikeyRoss Can you open a new discussion? https://github.com/pmndrs/zustand/discussions/new
@dai-shi, I see the checklist in the PR description, could I help tackle some of the bullet points? Thanks
@charkour I was wondering when we should start this, but if you are interested please go ahead. Note that I may have some hidden requirements which isn't described well in the bullet points, so bear with me. (I think I should work on the TS one on my own.)
We do something like this https://github.com/pmndrs/valtio/pull/810, so please open PRs for each point against v5 branch.
Sounds great! I can start on dropping the default exports.
No worries on the hidden requirements, I'm happy to help and let you take over if you disagree with one of my changes.
@dai-shi, are you willing to take on the next step on the task list? I can review but don't have time to code as much this week. Thanks
@dbritto-dev if you are interested you can take the next item.
@dai-shi let me take the next two tasks
Thanks! Please work on them one by one.
@dai-shi I'll take the second last too
Published: https://www.npmjs.com/package/zustand/v/5.0.0-alpha.0
I wonder if we should separate zustand/react entry point. We've done it in Jotai and Valtio.
Published: https://www.npmjs.com/package/zustand/v/5.0.0-alpha.1
I wonder if we should separate
zustand/reactentry point. We've done it in Jotai and Valtio.
We shall follow Jotai and Valtio
I wonder if we should separate
zustand/reactentry point. We've done it in Jotai and Valtio.We shall follow Jotai and Valtio
#2303
Published: https://www.npmjs.com/package/zustand/v/5.0.0-alpha.2
Would anyone try it and see if there are any issues?
Published: https://www.npmjs.com/package/zustand/v/5.0.0-alpha.3
Published: https://www.npmjs.com/package/zustand/v/5.0.0-alpha.4
FYI @DavideSegullo We consider it a bad practice. #2395
Published: https://www.npmjs.com/package/zustand/v/5.0.0-alpha.5
FYI @DavideSegullo We consider it a bad practice. #2395
Oh thank you!! I tought, by reading It that It was a good pattern. Why isn't it a good practice?
The fact that it works now doesn't mean it works for the future version. use-sync-external-store is provided by React and they say they maintain it to make it work for the future. (If there was a bug, we would report it to them.) So, it's better for the community than having our own hacks.
The fact that it works now doesn't mean it works for the future version.
use-sync-external-storeis provided by React and they say they maintain it to make it work for the future. (If there was a bug, we would report it to them.) So, it's better for the community than having our own hacks.
Makes sense, thank you!
Hi. Thanks for the library, always nice. I have one minor question: why the code is remained for createState that being nullable in createStore, which was previously left for context?
I checked out v5 and saw that removing it still passes all my tests, is it for external libraries?
export const createStore = ((createState) =>
createState ? createStoreImpl(createState) : createStoreImpl) as CreateStore