Skip to content

feat(middleare/persist): return storage promise from setState#3206

Merged
dai-shi merged 5 commits intomainfrom
persist-set-state
Aug 19, 2025
Merged

feat(middleare/persist): return storage promise from setState#3206
dai-shi merged 5 commits intomainfrom
persist-set-state

Conversation

@dai-shi
Copy link
Copy Markdown
Member

@dai-shi dai-shi commented Aug 8, 2025

fix #3196

persist middleware to mutate setState so that it returns what storage.setItem returns.

This is a suboptimal solution as we can't infer types. It's always unknown. Nevertheless, it should be usable if we assert types in a certain case.

@vercel
Copy link
Copy Markdown

vercel bot commented Aug 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
zustand-demo Ready Ready Preview Comment Aug 19, 2025 11:07pm

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Aug 8, 2025

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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Aug 8, 2025

demostarter

npm i https://pkg.pr.new/zustand@3206

commit: 9584403

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 8, 2025

Size Change: -2 B (-0.02%)

Total Size: 12.6 kB

Filename Size Change
./dist/esm/middleware.mjs 3.86 kB -1 B (-0.03%)
./dist/middleware.js 3.87 kB -1 B (-0.03%)
ℹ️ View Unchanged
Filename Size
./dist/esm/index.mjs 64 B
./dist/esm/middleware/immer.mjs 212 B
./dist/esm/react.mjs 340 B
./dist/esm/react/shallow.mjs 198 B
./dist/esm/shallow.mjs 82 B
./dist/esm/traditional.mjs 411 B
./dist/esm/vanilla.mjs 403 B
./dist/esm/vanilla/shallow.mjs 557 B
./dist/index.js 244 B
./dist/middleware/immer.js 231 B
./dist/react.js 355 B
./dist/react/shallow.js 213 B
./dist/shallow.js 189 B
./dist/traditional.js 423 B
./dist/vanilla.js 416 B
./dist/vanilla/shallow.js 568 B

compressed-size-action

@dai-shi dai-shi added this to the v5.0.8 milestone Aug 19, 2025
@dai-shi dai-shi marked this pull request as ready for review August 19, 2025 22:40
@dai-shi dai-shi merged commit feddc0c into main Aug 19, 2025
32 checks passed
@dai-shi dai-shi deleted the persist-set-state branch August 19, 2025 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant