Skip to content

Commit

Permalink
fix: apply optimistic updates from READ requests immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg authored and kirillzyusko committed Sep 23, 2024
1 parent d009d8e commit c52bc36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/API/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ function waitForWrites<TCommand extends ReadCommand>(command: TCommand) {
function read<TCommand extends ReadCommand>(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);
});
}
Expand Down

0 comments on commit c52bc36

Please sign in to comment.