@@ -12,7 +12,6 @@ import {
12
12
useCallback ,
13
13
useEffect ,
14
14
useLayoutEffect ,
15
- useMemo ,
16
15
useState ,
17
16
} from 'react' ;
18
17
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom' ;
@@ -42,11 +41,14 @@ export function useEditableValue(
42
41
const [ parsedValue , setParsedValue ] = useState ( initialValue ) ;
43
42
const [ isValid , setIsValid ] = useState ( initialIsValid ) ;
44
43
45
- const reset = useCallback ( ( ) => {
46
- setEditableValue ( smartStringify ( initialValue ) ) ;
47
- setParsedValue ( initialValue ) ;
48
- setIsValid ( initialIsValid ) ;
49
- } , [ ] ) ;
44
+ const reset = useCallback (
45
+ ( ) => {
46
+ setEditableValue ( smartStringify ( initialValue ) ) ;
47
+ setParsedValue ( initialValue ) ;
48
+ setIsValid ( initialIsValid ) ;
49
+ } ,
50
+ [ initialValue , initialIsValid ] ,
51
+ ) ;
50
52
51
53
const update = useCallback ( newValue => {
52
54
let isNewValueValid = false ;
@@ -65,17 +67,14 @@ export function useEditableValue(
65
67
} ) ;
66
68
} , [ ] ) ;
67
69
68
- return useMemo (
69
- ( ) => ( {
70
- editableValue,
71
- hasPendingChanges : smartStringify ( initialValue ) !== editableValue ,
72
- isValid,
73
- parsedValue,
74
- reset,
75
- update,
76
- } ) ,
77
- [ editableValue , initialValue , isValid , parsedValue ] ,
78
- ) ;
70
+ return {
71
+ editableValue,
72
+ hasPendingChanges : smartStringify ( initialValue ) !== editableValue ,
73
+ isValid,
74
+ parsedValue,
75
+ reset,
76
+ update,
77
+ } ;
79
78
}
80
79
81
80
export function useIsOverflowing (
0 commit comments