Skip to content

Commit

Permalink
Merge pull request #44251 from Expensify/revert-44106-add-logs-to-com…
Browse files Browse the repository at this point in the history
…poser

[CP Staging] Revert "[Composer] Add logs in Composer-related logic to track bug with disappearing text"
  • Loading branch information
mountiny authored Jun 24, 2024
2 parents f97782a + 163e2fc commit 200590d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
12 changes: 0 additions & 12 deletions src/components/Composer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import updateIsFullComposerAvailable from '@libs/ComposerUtils/updateIsFullCompo
import * as EmojiUtils from '@libs/EmojiUtils';
import * as FileUtils from '@libs/fileDownload/FileUtils';
import isEnterWhileComposition from '@libs/KeyboardShortcut/isEnterWhileComposition';
import Log from '@libs/Log';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import CONST from '@src/CONST';
import type {ComposerProps} from './types';
Expand Down Expand Up @@ -107,22 +106,11 @@ function Composer(
const isScrollBarVisible = useIsScrollBarVisible(textInput, value ?? '');
const [prevScroll, setPrevScroll] = useState<number | undefined>();

// Those useEffects track changes of `shouldClear` and `onClear` independently.
useEffect(() => {
Log.info('[Composer] `shouldClear` value changed', true, {shouldClear});
}, [shouldClear]);

useEffect(() => {
Log.info('[Composer] `onClear` value changed', true, {shouldClear});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [onClear]);

useEffect(() => {
if (!shouldClear) {
return;
}
textInput.current?.clear();
Log.info('[Composer] `textInput` cleared', true, {shouldClear});
onClear();
}, [shouldClear, onClear]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import * as EmojiUtils from '@libs/EmojiUtils';
import focusComposerWithDelay from '@libs/focusComposerWithDelay';
import getPlatform from '@libs/getPlatform';
import * as KeyDownListener from '@libs/KeyboardShortcut/KeyDownPressListener';
import Log from '@libs/Log';
import {parseHtmlToMarkdown} from '@libs/OnyxAwareParser';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
Expand Down Expand Up @@ -278,7 +277,6 @@ function ComposerWithSuggestions(
const tag = useSharedValue(-1);
const draftComment = getDraftComment(reportID) ?? '';
const [value, setValue] = useState(() => {
Log.info('[ComposerWithSuggestions] Initializing state `value` with draftComment', true, {draftComment});
if (draftComment) {
emojisPresentBefore.current = EmojiUtils.extractEmojis(draftComment);
}
Expand Down Expand Up @@ -436,7 +434,6 @@ function ComposerWithSuggestions(
setIsCommentEmpty(isNewCommentEmpty);
}
emojisPresentBefore.current = emojis;
Log.info('[ComposerWithSuggestions] Setting new comment value', true, {newValue: newCommentConverted, oldValue: value});
setValue(newCommentConverted);
if (commentValue !== newComment) {
const position = Math.max((selection.end ?? 0) + (newComment.length - commentRef.current.length), cursorPosition ?? 0);
Expand Down Expand Up @@ -464,8 +461,6 @@ function ComposerWithSuggestions(
debouncedBroadcastUserIsTyping(reportID);
}
},
// We don't want to have `value` in dependencies since it is only used in Log.info
// eslint-disable-next-line react-hooks/exhaustive-deps
[
debouncedUpdateFrequentlyUsedEmojis,
findNewlyAddedChars,
Expand Down Expand Up @@ -497,15 +492,12 @@ function ComposerWithSuggestions(

setSelection({start: 0, end: 0, positionX: 0, positionY: 0});
updateComment('');
Log.info('[ComposerWithSuggestions] `textInputShouldClear` changed to true', true, {oldTextInputShouldClear: textInputShouldClear});
setTextInputShouldClear(true);
if (isComposerFullSize) {
Report.setIsComposerFullSize(reportID, false);
}
setIsFullComposerAvailable(false);
return trimmedComment;
// We don't want to have `textInputShouldClear` in dependencies since it is only used in Log.info
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [updateComment, setTextInputShouldClear, isComposerFullSize, setIsFullComposerAvailable, reportID, debouncedSaveReportComment]);

/**
Expand Down Expand Up @@ -750,7 +742,6 @@ function ComposerWithSuggestions(
);

const onClear = useCallback(() => {
Log.info('[ComposerWithSuggestions] `onClear` called', true);
setTextInputShouldClear(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import canFocusInputOnScreenFocus from '@libs/canFocusInputOnScreenFocus';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import {getDraftComment} from '@libs/DraftCommentUtils';
import getModalState from '@libs/getModalState';
import Log from '@libs/Log';
import * as ReportUtils from '@libs/ReportUtils';
import playSound, {SOUNDS} from '@libs/Sound';
import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside';
Expand Down Expand Up @@ -161,7 +160,6 @@ function ReportActionCompose({
const [textInputShouldClear, setTextInputShouldClear] = useState(false);
const [isCommentEmpty, setIsCommentEmpty] = useState(() => {
const draftComment = getDraftComment(reportID);
Log.info('[ReportActionCompose] Initializing state `isCommentEmpty` with value that depends on draftComment', true, {draftComment});
return !draftComment || !!draftComment.match(/^(\s)*$/);
});

Expand Down Expand Up @@ -269,11 +267,8 @@ function ReportActionCompose({
playSound(SOUNDS.DONE);
const newComment = composerRef?.current?.prepareCommentAndResetComposer();
Report.addAttachment(reportID, file, newComment);
Log.info('[ReportActionCompose] `textInputShouldClear` changed to false', true, {oldTextInputShouldClear: textInputShouldClear});
setTextInputShouldClear(false);
},
// We don't want to have `textInputShouldClear` in dependencies since it is only used in Log.info
// eslint-disable-next-line react-hooks/exhaustive-deps
[reportID],
);

Expand Down

0 comments on commit 200590d

Please sign in to comment.