From c52bc3691120c2652b6cb02bd76a0834a0dbe6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Tue, 27 Aug 2024 09:21:21 +0200 Subject: [PATCH] fix: apply optimistic updates from READ requests immediately --- src/libs/API/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/API/index.ts b/src/libs/API/index.ts index 65fd2b6ad015..20df92dc8126 100644 --- a/src/libs/API/index.ts +++ b/src/libs/API/index.ts @@ -181,8 +181,9 @@ function waitForWrites(command: TCommand) { function read(command: TCommand, apiCommandParameters: ApiRequestCommandParameters[TCommand], onyxData: OnyxData = {}): void { Log.info('[API] Called API.read', false, {command, ...apiCommandParameters}); + // Apply optimistic updates of read requests immediately + const request = prepareRequest(command, CONST.API_REQUEST_TYPE.READ, apiCommandParameters, onyxData); waitForWrites(command).then(() => { - const request = prepareRequest(command, CONST.API_REQUEST_TYPE.READ, apiCommandParameters, onyxData); processRequest(request, CONST.API_REQUEST_TYPE.READ); }); }