Skip to content

Commit

Permalink
Merge pull request #39934 from callstack-internal/fix/save-white-char…
Browse files Browse the repository at this point in the history
…acters-only-drafts

Fix: Composer - Pointer returns to previous line when adding new line
(cherry picked from commit f6ecad5)
  • Loading branch information
Julesssss authored and OSBotify committed Apr 9, 2024
1 parent 2f021a1 commit f4e94dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libs/DraftCommentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function getDraftComment(reportID: string): OnyxEntry<string> | null | undefined
* A valid draft comment is a non-empty string.
*/
function isValidDraftComment(comment?: string | null): boolean {
return !!comment?.trim();
return !!comment;
}

/**
Expand All @@ -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};

0 comments on commit f4e94dc

Please sign in to comment.