Skip to content

Commit

Permalink
Fix caching of callbacks in useEditableValue
Browse files Browse the repository at this point in the history
  • Loading branch information
limemloh committed Oct 30, 2024
1 parent 3155d01 commit ceb05d2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ export default function useEditableValue(current: string, fallback: string, onNe
const onAbort = useCallback(() => {
setIsEditing(false);
setEdited(current);
}, []);
}, [current]);
const onComplete = useCallback(() => {
onNewValue(edited.trim());
setIsEditing(false);
}, []);
}, [edited]);
const onEdit = useCallback(() => {
setEdited(current);
setIsEditing(true);
}, []);
}, [current]);
const onInputChange = (event: ChangeEvent<HTMLInputElement>) => {
setEdited(event.target.value);
};
Expand Down

0 comments on commit ceb05d2

Please sign in to comment.