Skip to content

Commit

Permalink
style(custom-keybinding): useCallback dependency fix
Browse files Browse the repository at this point in the history
  • Loading branch information
koepferd committed Oct 2, 2024
1 parent a35855a commit 8ff4d2d
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,23 +412,6 @@ export const MessageSubmitInterfaceComponent = ({
return getDefaultKeyBinding(event);
};

const handleEditorKeyCommand = useCallback(
(command) => {
const newState = RichUtils.handleKeyCommand(editorState, command);
if (command === 'shift-enter') {
handleButtonClick();
return 'handled';
}

if (newState) {
handleEditorChange(newState);
return 'handled';
}
return 'not-handled';
},
[editorState, handleEditorChange]
);

const resizeTextarea = useCallback(() => {
const textInput: any = textareaInputRef.current;
// default values
Expand Down Expand Up @@ -795,6 +778,23 @@ export const MessageSubmitInterfaceComponent = ({
userData
]);

const handleEditorKeyCommand = useCallback(
(command) => {
const newState = RichUtils.handleKeyCommand(editorState, command);
if (command === 'shift-enter') {
handleButtonClick();
return 'handled';
}

if (newState) {
handleEditorChange(newState);
return 'handled';
}
return 'not-handled';
},
[editorState, handleEditorChange, handleButtonClick]
);

const handleRequestFeedbackCheckbox = useCallback(() => {
setRequestFeedbackCheckboxChecked(
(requestFeedbackCheckboxChecked) => !requestFeedbackCheckboxChecked
Expand Down

0 comments on commit 8ff4d2d

Please sign in to comment.