Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist documentation for Map & Set add storage and retrieval of version #2692

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

melutovich
Copy link
Contributor

--HG--
branch : discussion-2689-persist-doc-map-and-set-missing-version

Related Bug Reports or Discussions

Fixes # Discussion 2689

Summary

Fixes getItem and setItem on the storage for the Map & Set persist example, so that respectfully those methods retrieves and sets the version when present.

Check List

  • [v] pnpm run prettier for formatting code and docs

--HG--
branch : discussion-2689-persist-doc-map-and-set-missing-version
Copy link

vercel bot commented Aug 20, 2024

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 20, 2024 9:20pm

Copy link

codesandbox-ci bot commented Aug 20, 2024

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.

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening up a PR! I think a small change is required. Thanks.

docs/integrations/persisting-store-data.md Show resolved Hide resolved
return {
state: {
...state,
transactions: new Map(state.transactions),
},
version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes version: undefined if version is undefined. We also need to use object spread here like setItem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed another commit switching this as you've suggested.

…n only when present by way of spread operator on existingValue

--HG--
branch : discussion-2689-persist-doc-map-and-set-missing-version
Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thanks for your contribution.

@dai-shi dai-shi merged commit 23086be into pmndrs:main Aug 20, 2024
25 checks passed
@melutovich melutovich deleted the discussion-2689 branch August 21, 2024 08:24
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