Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment thread
kacper-mikolajczak marked this conversation as resolved.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
return comment?.trim() || null;
return comment || null;
}

export {getDraftComment, isValidDraftComment, hasValidDraftComment, prepareDraftComment};