unstale

npm / zustand

zustand

What changed in zustand 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

29 breaking6 new APIs and options1 performance4 behavior and defaults2 tooling14 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

zustand 533 changes

Breaking changes 9

New APIs and options 4

  • The new option enables dispatching store actions directly from Redux DevTools.

    5.1.0release notes

  • An experimental middleware is available for a new usage with Next.js.

    5.0.9release notes

  • Use createWithEqualityFn from zustand/traditional when a custom equality function is needed or v4 behavior is required.

    5.0.0upgrade guide

  • The useShallow hook provides a stable reference for selector results, including the shallow-equality use case.

    5.0.0upgrade guide

Performance 1

  • useStore no longer memoizes getServerSnapshot.

    5.0.16release notes

Behavior and default changes 4

  • The middleware supports nested actions and arguments when dispatching store actions from Redux DevTools.

    5.1.0release notes

  • It now returns a native Promise<void> that can be awaited to ensure hydration is complete.

    5.1.0release notes

  • The middleware now supports PromiseLike results from storage reads, migrations, and migration writes.

    5.1.0release notes

  • Selectors that return a new reference may cause infinite loops; selector results should be stable.

    5.0.0upgrade guide

Tooling 2

  • Improves typing in the devtools middleware.

    5.0.11release notes

  • Package entry points are reorganized in package.json.

    5.0.0release notes

Fixes and other changes 13

  • Shared devtools connections are preserved during store cleanup.

    5.0.16release notes

  • External devtools action arguments are preserved.

    5.0.16release notes

  • Devtools message parsing now applies serialize.reviver.

    5.0.16release notes

  • clearStorage() now invalidates concurrent asynchronous rehydration.

    5.0.15release notes

  • Corrected the V8 stack regex when a source path contains spaces.

    5.0.15release notes

  • Improves type inference for the Devtools initializer.

    5.0.14release notes

  • Supports Firefox and Safari stack formats when finding the caller name in devtools middleware.

    5.0.13release notes

  • Corrected the Redux DevTools configuration type extension.

    5.0.12release notes

  • The post-rehydration callback now uses the latest state.

    5.0.12release notes

  • Fixes immer middleware typing when used in combination with slices.

    5.0.11release notes

  • The persist middleware no longer relies on global localStorage.

    5.0.11release notes

  • Fixes a race condition during concurrent rehydrate calls in the persist middleware.

    5.0.10release notes

  • Immer type inference for setState is fixed.

    5.0.0release notes

zustand 423 changes

Breaking changes 20

  • The TypeScript signature changes to a curried form for explicit state types: replace create<T, ...>(...) with create<T>()(...).

    4.0.0upgrade guide

  • The generic parameter now represents the store type; replace createContext<T>() with createContext<StoreApi<T>>().

    4.0.0upgrade guide

  • v4 exposes createStore for more flexible context usage and exports it from vanilla.

    4.0.0release notes

  • Devtools deprecations and warnings were removed.

    4.0.0release notes

  • The devtools middleware now uses the official devtools extension types.

    4.0.0release notes

  • Higher kinded mutator types were added.

    4.0.0release notes

  • The devtools middleware no longer checks the old string option.

    4.0.0release notes

  • The type now accepts only T and represents Partial<T> or a function returning Partial<T>; replace PartialState<T, ...> with PartialState<T>.

    4.0.0upgrade guide

  • Deprecated persist options were dropped in v4.

    4.0.0release notes

  • The TypeScript signature adds mutator type parameters; remove explicit type parameters and annotate only the action parameter.

    4.0.0upgrade guide

  • removeItem is now required.

    4.0.0release notes

  • The type parameters now describe input and output mutators and the return type, changing annotations for middleware and slices.

    4.0.0upgrade guide

  • The deprecated store.subscribe API with a selector was dropped.

    4.0.0release notes

  • v4 depends on use-sync-external-store; the notes warn that this might cause bundling issues.

    4.0.0release notes

  • The type now takes a store type; replace UseBoundStore<T> with UseBoundStore<StoreApi<T>>, and UseBoundStore<T, S> with UseBoundStore<S>.

    4.0.0upgrade guide

  • This type is removed; use typeof MyContext.useStore instead.

    4.0.0upgrade guide

  • The TypeScript signature now takes the store type as its first type parameter; remove explicit type parameters or pass the store type instead of the state type.

    4.0.0upgrade guide

  • v4 exposes useStore as part of its more flexible API for context usage.

    4.0.0release notes

  • The deprecated UseStore type was dropped.

    4.0.0release notes

  • Compatibility with v2 hooks was dropped.

    4.0.0release notes

New APIs and options 2

  • The devtools middleware gained an enabled option, and shows its warning only if enabled.

    4.0.0release notes

  • The persist API gained a getOptions method.

    4.0.0release notes

Fixes and other changes 1

  • The partialized-state type is now T rather than Partial<T>, matching the identity default partialize; runtime behavior is unchanged.

    4.0.0upgrade guide