From f4e94dc97d374438e0b75e7637322c6172ec0f4e Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 9 Apr 2024 16:32:58 +0100 Subject: [PATCH] Merge pull request #39934 from callstack-internal/fix/save-white-characters-only-drafts Fix: Composer - Pointer returns to previous line when adding new line (cherry picked from commit f6ecad5c6c6372ceb76be544941e0854ec0d0cc9) --- src/libs/DraftCommentUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/DraftCommentUtils.ts b/src/libs/DraftCommentUtils.ts index 325da93d235e..b3cb32498725 100644 --- a/src/libs/DraftCommentUtils.ts +++ b/src/libs/DraftCommentUtils.ts @@ -25,7 +25,7 @@ function getDraftComment(reportID: string): OnyxEntry | null | undefined * A valid draft comment is a non-empty string. */ function isValidDraftComment(comment?: string | null): boolean { - return !!comment?.trim(); + return !!comment; } /** @@ -36,12 +36,12 @@ function hasValidDraftComment(reportID: string): boolean { } /** - * Prepares a draft comment by trimming it and returning null if it's empty. + * Prepares a draft comment by returning null if it's empty. */ function prepareDraftComment(comment: string | null) { // logical OR is used to convert empty string to null // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - return comment?.trim() || null; + return comment || null; } export {getDraftComment, isValidDraftComment, hasValidDraftComment, prepareDraftComment};