Skip to content

docs(persist): clarify createJSONStorage behavior and warn about production use - #3541

Merged
dai-shi merged 3 commits into
mainfrom
copilot/update-docs-based-on-issue-2659
Jul 9, 2026
Merged

docs(persist): clarify createJSONStorage behavior and warn about production use#3541
dai-shi merged 3 commits into
mainfrom
copilot/update-docs-based-on-issue-2659

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

#3540

createJSONStorage is widely used in examples but lacks type safety and runtime validation — data read from storage is blindly cast to the state type, so corrupt or stale values are silently accepted. No warning about this existed in the docs.

Summary

  • storage option description — expanded to explain the lazy getter pattern (SSR safety) and added an inline warning that createJSONStorage does not validate the deserialized shape; recommends a custom PersistStorage with schema validation (e.g. Zod) for production use.
  • "Persisting a state with custom storage" section — added a note at the top of the section reinforcing the same point: createJSONStorage is suited for prototyping, not production.

Check List

  • pnpm run fix for formatting and linting code and docs

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
zustand-demo Ready Ready Preview, Comment Jul 9, 2026 9:35pm

Request Review

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 13.1 kB

ℹ️ View Unchanged
Filename Size
dist/esm/index.mjs 64 B
dist/esm/middleware.mjs 4.1 kB
dist/esm/middleware/immer.mjs 212 B
dist/esm/react.mjs 342 B
dist/esm/react/shallow.mjs 198 B
dist/esm/shallow.mjs 82 B
dist/esm/traditional.mjs 412 B
dist/esm/vanilla.mjs 405 B
dist/esm/vanilla/shallow.mjs 557 B
dist/index.js 244 B
dist/middleware.js 4.11 kB
dist/middleware/immer.js 231 B
dist/react.js 357 B
dist/react/shallow.js 213 B
dist/shallow.js 189 B
dist/traditional.js 426 B
dist/vanilla.js 418 B
dist/vanilla/shallow.js 568 B

compressed-size-action

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026

Copy link
Copy Markdown

commit: 2c6a0bf

Copilot AI requested a review from dai-shi July 9, 2026 21:35
@dai-shi
dai-shi marked this pull request as ready for review July 9, 2026 21:37
@dai-shi
dai-shi merged commit 038f496 into main Jul 9, 2026
32 checks passed
@dai-shi
dai-shi deleted the copilot/update-docs-based-on-issue-2659 branch July 9, 2026 21:43
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.

2 participants