Skip to content

docs(persist): fix signature to require persistOptions#3477

Merged
dbritto-dev merged 1 commit into
pmndrs:mainfrom
pavan-sh:docs/fix-persist-signature-options-required
Apr 27, 2026
Merged

docs(persist): fix signature to require persistOptions#3477
dbritto-dev merged 1 commit into
pmndrs:mainfrom
pavan-sh:docs/fix-persist-signature-options-required

Conversation

@pavan-sh

Copy link
Copy Markdown
Contributor

Related Bug Reports or Discussions

Fixes #

Summary

The persist docs showed persistOptions as optional, which is misleading. In practice, persist needs a config object (including a required name), so calling it with only the state creator is not valid.

This PR updates the TypeScript signature and reference heading in the persist docs to clearly show the correct usage: persist(stateCreatorFn, persistOptions).

Ref:
https://github.com/pmndrs/zustand/blob/main/src/middleware/persist.ts#L377-L385
https://github.com/pmndrs/zustand/blob/main/src/middleware/persist.ts#L59-L73

Check List

(docs only change)

  • pnpm run fix for formatting and linting code and docs

@vercel

vercel Bot commented Apr 27, 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 Apr 27, 2026 2:24am

Request Review

@codesandbox-ci

Copy link
Copy Markdown

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

pkg-pr-new Bot commented Apr 27, 2026

Copy link
Copy Markdown

commit: c091a3b

@dbritto-dev dbritto-dev merged commit 1b04af1 into pmndrs:main Apr 27, 2026
33 checks passed
@dbritto-dev

Copy link
Copy Markdown
Collaborator

Thanks for your contribution

@pavan-sh

Copy link
Copy Markdown
Contributor Author

Thanks for your contribution

Happy to help!

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