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

Update zustand 4.5.2 → 5.0.0 (major) #3257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

depfu[bot]
Copy link
Contributor

@depfu depfu bot commented Oct 21, 2024

Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ zustand (4.5.2 → 5.0.0) · Repo

Release Notes

5.0.0

🎉🎉🎉 Zustand v5 🐻🐻🐻

TL;DR

  • No new features
  • Drop many old things
  • Migration from v4 should be smooth.

Changes in v5

  • Drop default exports
  • Drop deprecated features
  • Make React 18 the minimum required version
  • Make use-sync-external-store a peer dependency (required for createWithEqualityFn and useStoreWithEqualityFn in zustand/traditional)
  • Make TypeScript 4.5 the minimum required version
  • Drop UMD/SystemJS support
  • Organize entry points in the package.json
  • Drop ES5 support
  • Stricter types when setState's replace flag is set
  • Persist middleware behavioral change
  • Other small improvements (technically breaking changes)

Migration Guide

Read the migration guide carefully:
https://github.com/pmndrs/zustand/blob/main/docs/migrations/migrating-to-v5.md

Frequently Reported Issue

During the RC period, some users encountered the following infinite loop error:

Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

This case was already a non-ideal behavior in v4 but appears more explicitly as an error in v5. While there are several ways to resolve this, using useShallow often fixes the problem.

What's Changed

New Contributors

Full Changelog: v4.5.5...v5.0.0

4.5.5

This improves the persist middleware behavior for an edge case.

What's Changed

New Contributors

Full Changelog: v4.5.4...v4.5.5

4.5.4

There was an issue in v4.5.3 with some bundlers.

What's Changed

Full Changelog: v4.5.3...v4.5.4

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu bot added the dependencies Pull requests that update a dependency file label Oct 21, 2024
Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] environment 0 11.5 kB knownasilya
npm/[email protected] None 0 88.6 kB daishi

🚮 Removed packages: npm/[email protected], npm/[email protected]

View full report↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants