From 703957d7c007db384a84458da6a702f60c8223df Mon Sep 17 00:00:00 2001 From: Eduardo Date: Fri, 27 Sep 2024 21:25:37 +0200 Subject: [PATCH] Fixed comments --- src/libs/Network/SequentialQueue.ts | 7 +++---- src/libs/ReportActionsUtils.ts | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libs/Network/SequentialQueue.ts b/src/libs/Network/SequentialQueue.ts index 14157d2533ef..35c7b2bf779a 100644 --- a/src/libs/Network/SequentialQueue.ts +++ b/src/libs/Network/SequentialQueue.ts @@ -205,15 +205,14 @@ function isPaused(): boolean { NetworkStore.onReconnection(flush); function push(newRequest: OnyxRequest) { - // If a request is already being processed, ignore it when looking for potentially conflicting requests - const requests = PersistedRequests.getAll(); - const {checkAndFixConflictingRequest} = newRequest; + if (checkAndFixConflictingRequest) { + const requests = PersistedRequests.getAll(); const {conflictAction} = checkAndFixConflictingRequest(requests); Log.info(`[SequentialQueue] Conflict action for command ${newRequest.command} - ${conflictAction.type}:`); - // No need to serialize it. + // don't try to serialize a function. // eslint-disable-next-line no-param-reassign delete newRequest.checkAndFixConflictingRequest; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index ee2da7f1f849..6b176edb6916 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -215,7 +215,7 @@ function isActionOfType( function getOriginalMessage(reportAction: OnyxInputOrEntry>): OriginalMessage | undefined { if (!Array.isArray(reportAction?.message)) { // eslint-disable-next-line deprecation/deprecation - return reportAction?.message ?? reportAction.originalMessage; + return reportAction?.message ?? reportAction?.originalMessage; } // eslint-disable-next-line deprecation/deprecation return reportAction.originalMessage; @@ -697,7 +697,7 @@ function isResolvedActionTrackExpense(reportAction: OnyxEntry): bo * Checks if a reportAction is fit for display as report last action, meaning that * it satisfies shouldReportActionBeVisible, it's not whisper action and not deleted. */ -function shouldReportActionBeVisibleAsLastAction(reportAction: OnyxInputOrEntry, key: string | number): boolean { +function shouldReportActionBeVisibleAsLastAction(reportAction: OnyxInputOrEntry): boolean { if (!reportAction) { return false; } @@ -709,7 +709,7 @@ function shouldReportActionBeVisibleAsLastAction(reportAction: OnyxInputOrEntry< // If a whisper action is the REPORT_PREVIEW action, we are displaying it. // If the action's message text is empty and it is not a deleted parent with visible child actions, hide it. Else, consider the action to be displayable. return ( - shouldReportActionBeVisible(reportAction, key) && + shouldReportActionBeVisible(reportAction, reportAction.reportActionID) && !(isWhisperAction(reportAction) && !isReportPreviewAction(reportAction) && !isMoneyRequestAction(reportAction)) && !(isDeletedAction(reportAction) && !isDeletedParentAction(reportAction)) && !isResolvedActionTrackExpense(reportAction) @@ -823,7 +823,7 @@ function getSortedReportActionsForDisplay(reportActions: OnyxEntry shouldReportActionBeVisible(reportAction)) + .filter(([key, reportAction]) => shouldReportActionBeVisible(reportAction, key)) .map(([, reportAction]) => reportAction); }