Socket
Socket
Sign inDemoInstall

zustand

Package Overview
Dependencies
Maintainers
3
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zustand - npm Package Compare versions

Comparing version 5.0.0-rc.0 to 5.0.0-rc.1

6

middleware/immer.d.ts

@@ -17,5 +17,5 @@ import type { Draft } from 'immer';

} ? [] : T extends [unknown, unknown, ...infer A] ? A : T extends [unknown, unknown?, ...infer A] ? A : T extends [unknown?, unknown?, ...infer A] ? A : never;
type SetStateType<T extends unknown[]> = Exclude<T[0], (...args: any[]) => any>;
type WithImmer<S> = Write<S, StoreImmer<S>>;
type StoreImmer<S> = S extends {
getState: () => infer T;
setState: infer SetState;

@@ -26,6 +26,6 @@ } ? SetState extends {

} ? {
setState(nextStateOrUpdater: T | Partial<T> | ((state: Draft<T>) => void), shouldReplace?: false, ...a: SkipTwo<A1>): Sr1;
setState(nextStateOrUpdater: T | ((state: Draft<T>) => void), shouldReplace: true, ...a: SkipTwo<A2>): Sr2;
setState(nextStateOrUpdater: SetStateType<A2> | Partial<SetStateType<A2>> | ((state: Draft<SetStateType<A2>>) => void), shouldReplace?: false, ...a: SkipTwo<A1>): Sr1;
setState(nextStateOrUpdater: SetStateType<A2> | ((state: Draft<SetStateType<A2>>) => void), shouldReplace: true, ...a: SkipTwo<A2>): Sr2;
} : never : never;
export declare const immer: Immer;
export {};

@@ -6,3 +6,3 @@ {

"type": "commonjs",
"version": "5.0.0-rc.0",
"version": "5.0.0-rc.1",
"publishConfig": {

@@ -9,0 +9,0 @@ "tag": "next"

@@ -7,11 +7,13 @@ 'use strict';

const { useRef } = ReactExports;
const sliceCache = /* @__PURE__ */ new WeakMap();
function useShallow(selector) {
const prev = useRef();
const key = useRef({}).current;
return (state) => {
const prev = sliceCache.get(key);
const next = selector(state);
return shallow.shallow(prev.current, next) ? prev.current : (
// It might not work with React Compiler
// eslint-disable-next-line react-compiler/react-compiler
prev.current = next
);
if (shallow.shallow(prev, next)) {
return prev;
}
sliceCache.set(key, next);
return next;
};

@@ -18,0 +20,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc