Skip to content

Commit

Permalink
fix rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanDylann committed Dec 13, 2023
1 parent 62718fc commit 37acb42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useHandleExceedMaxCommentLength.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const useHandleExceedMaxCommentLength = () => {
[hasExceededMaxCommentLength],
);

const handleValueChangeDebounce = useMemo(() => _.debounce(handleValueChange, 1500), [handleValueChange]);
const validateCommentMaxLength = useMemo(() => _.debounce(handleValueChange, 1500), [handleValueChange]);

return {hasExceededMaxCommentLength, handleValueChangeDebounce};
return {hasExceededMaxCommentLength, validateCommentMaxLength};
};

export default useHandleExceedMaxCommentLength;
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function ReportActionCompose({
* Updates the composer when the comment length is exceeded
* Shows red borders and prevents the comment from being sent
*/
const {handleValueChangeDebounce, hasExceededMaxCommentLength} = useHandleExceedMaxCommentLength();
const {hasExceededMaxCommentLength, validateCommentMaxLength} = useHandleExceedMaxCommentLength();

const suggestionsRef = useRef(null);
const composerRef = useRef(null);
Expand Down Expand Up @@ -409,7 +409,7 @@ function ReportActionCompose({
onBlur={onBlur}
measureParentContainer={measureContainer}
listHeight={listHeight}
onValueChange={handleValueChangeDebounce}
onValueChange={validateCommentMaxLength}
/>
<ReportDropUI
onDrop={(e) => {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function ReportActionItemMessageEdit(props) {
});
const [selection, setSelection] = useState(getInitialSelection);
const [isFocused, setIsFocused] = useState(false);
const {handleValueChangeDebounce, hasExceededMaxCommentLength} = useHandleExceedMaxCommentLength();
const {hasExceededMaxCommentLength, validateCommentMaxLength} = useHandleExceedMaxCommentLength();
const [modal, setModal] = useState(false);
const [onyxFocused, setOnyxFocused] = useState(false);

Expand Down Expand Up @@ -370,8 +370,8 @@ function ReportActionItemMessageEdit(props) {
const focus = focusComposerWithDelay(textInputRef.current);

useEffect(() => {
handleValueChangeDebounce(draft);
}, [draft, handleValueChangeDebounce]);
validateCommentMaxLength(draft);
}, [draft, validateCommentMaxLength]);

return (
<>
Expand Down

0 comments on commit 37acb42

Please sign in to comment.