From ccedd1c5d7e1132539d0a4b68f8285045185a1b8 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Wed, 15 May 2024 12:12:36 +0200 Subject: [PATCH] add comment --- .../actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts index c876df08d3fb..d34f069a1d76 100644 --- a/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts +++ b/src/libs/actions/OnyxUpdateManager/utils/DeferredOnyxUpdates.ts @@ -82,10 +82,13 @@ function enqueue(updates: OnyxUpdatesFromServer | DeferredUpdatesDictionary, opt SequentialQueue.pause(); } + // We check here if the "updates" param is a single update. + // If so, we only need to insert one update into the deferred updates queue. if (isValidOnyxUpdateFromServer(updates)) { const lastUpdateID = Number(updates.lastUpdateID); deferredUpdates[lastUpdateID] = updates; } else { + // If the "updates" param is an object, we need to insert multiple updates into the deferred updates queue. Object.entries(updates).forEach(([lastUpdateIDString, update]) => { const lastUpdateID = Number(lastUpdateIDString); if (deferredUpdates[lastUpdateID]) {