From 5252dc93c1f26536c4267537c5227c4dc766b165 Mon Sep 17 00:00:00 2001 From: Mario Mazzotti Date: Mon, 20 Jan 2025 17:51:05 -0300 Subject: [PATCH 1/3] add last update and update applied to client to OnyxUpdate logs --- src/libs/actions/OnyxUpdates.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index a09159993ad8..9e7a633c40ba 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -114,7 +114,9 @@ function apply({lastUpdateID, type, request, response, updates}: OnyxUpdatesFrom Log.info(`[OnyxUpdateManager] Applying update type: ${type} with lastUpdateID: ${lastUpdateID}`, false, {command: request?.command}); if (lastUpdateID && lastUpdateIDAppliedToClient && Number(lastUpdateID) <= lastUpdateIDAppliedToClient) { - Log.info('[OnyxUpdateManager] Update received was older than or the same as current state, returning without applying the updates other than successData and failureData'); + Log.info('[OnyxUpdateManager] Update received was older than or the same as current state, returning without applying the updates other than successData and failureData', false, { + lastUpdateID, lastUpdateIDAppliedToClient + }); // In this case, we're already received the OnyxUpdate included in the response, so we don't need to apply it again. // However, we do need to apply the successData and failureData from the request From 810ed844d8838b12d56792c29b7c85b143384ff9 Mon Sep 17 00:00:00 2001 From: Mario Mazzotti Date: Mon, 20 Jan 2025 18:01:36 -0300 Subject: [PATCH 2/3] run prettier --- src/libs/actions/OnyxUpdates.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index 9e7a633c40ba..6e318308513e 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -115,7 +115,8 @@ function apply({lastUpdateID, type, request, response, updates}: OnyxUpdatesFrom if (lastUpdateID && lastUpdateIDAppliedToClient && Number(lastUpdateID) <= lastUpdateIDAppliedToClient) { Log.info('[OnyxUpdateManager] Update received was older than or the same as current state, returning without applying the updates other than successData and failureData', false, { - lastUpdateID, lastUpdateIDAppliedToClient + lastUpdateID, + lastUpdateIDAppliedToClient, }); // In this case, we're already received the OnyxUpdate included in the response, so we don't need to apply it again. From 993b17ef0194999aa1ae3dea74f343b4981d5d80 Mon Sep 17 00:00:00 2001 From: Mario Mazzotti Date: Mon, 20 Jan 2025 18:11:21 -0300 Subject: [PATCH 3/3] fix eslint issues --- src/libs/actions/OnyxUpdates.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/OnyxUpdates.ts b/src/libs/actions/OnyxUpdates.ts index 6e318308513e..5a57e5622c53 100644 --- a/src/libs/actions/OnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdates.ts @@ -9,7 +9,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxUpdateEvent, OnyxUpdatesFromServer, Request} from '@src/types/onyx'; import type Response from '@src/types/onyx/Response'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import * as QueuedOnyxUpdates from './QueuedOnyxUpdates'; +import {queueOnyxUpdates} from './QueuedOnyxUpdates'; // This key needs to be separate from ONYXKEYS.ONYX_UPDATES_FROM_SERVER so that it can be updated without triggering the callback when the server IDs are updated. If that // callback were triggered it would lead to duplicate processing of server updates. @@ -30,7 +30,7 @@ function applyHTTPSOnyxUpdates(request: Request, response: Response) { console.debug('[OnyxUpdateManager] Applying https update'); // For most requests we can immediately update Onyx. For write requests we queue the updates and apply them after the sequential queue has flushed to prevent a replay effect in // the UI. See https://github.com/Expensify/App/issues/12775 for more info. - const updateHandler: (updates: OnyxUpdate[]) => Promise = request?.data?.apiRequestType === CONST.API_REQUEST_TYPE.WRITE ? QueuedOnyxUpdates.queueOnyxUpdates : Onyx.update; + const updateHandler: (updates: OnyxUpdate[]) => Promise = request?.data?.apiRequestType === CONST.API_REQUEST_TYPE.WRITE ? queueOnyxUpdates : Onyx.update; // First apply any onyx data updates that are being sent back from the API. We wait for this to complete and then // apply successData or failureData. This ensures that we do not update any pending, loading, or other UI states contained