Skip to content

Commit 7cf8567

Browse files
committed
chore: add immer to peerDependencies
1 parent 19186eb commit 7cf8567

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/hooks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
"types": "./index.d.ts",
2626
"dependencies": {
2727
"@react-devui/utils": "file:../utils",
28-
"immer": "^9.0.16",
2928
"lodash": "^4.17.21",
3029
"rxjs": "^7.6.0"
3130
},
3231
"peerDependencies": {
32+
"immer": ">=2.0.0",
3333
"react": "^18.2.0",
3434
"react-dom": "^18.2.0"
3535
},

packages/hooks/src/useImmer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export type ImmerHook<S> = [S, Updater<S>];
1010
export function useImmer<S>(): ImmerHook<S | undefined>;
1111
export function useImmer<S = any>(initialValue: S | (() => S)): ImmerHook<S>;
1212
export function useImmer(initialValue?: any) {
13-
const [val, updateValue] = useState(() => freeze(typeof initialValue === 'function' ? initialValue() : initialValue, true));
13+
const [value, updateValue] = useState(() => freeze(typeof initialValue === 'function' ? initialValue() : initialValue, true));
1414
const setValue = useCallback((updater: any) => {
1515
if (typeof updater === 'function') updateValue(produce(updater));
1616
else updateValue(freeze(updater));
1717
}, []);
18-
return [val, setValue];
18+
return [value, setValue];
1919
}

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
"@react-devui/hooks": "file:../hooks",
2828
"@react-devui/icons": "file:../icons",
2929
"@react-devui/utils": "file:../utils",
30-
"immer": "^9.0.16",
3130
"lodash": "^4.17.21",
3231
"rfs": "^9.0.6",
3332
"rxjs": "^7.6.0"
3433
},
3534
"peerDependencies": {
3635
"dayjs": "^1.11.7",
36+
"immer": ">=2.0.0",
3737
"react": "^18.2.0",
3838
"react-dom": "^18.2.0"
3939
},

0 commit comments

Comments
 (0)