Skip to content

Commit

Permalink
Merge pull request #48057 from margelo/fix/optimistic-read-updates
Browse files Browse the repository at this point in the history
fix: apply optimistic updates from READ requests immediately
  • Loading branch information
roryabraham authored Oct 2, 2024
2 parents 526845b + c52bc36 commit a6d812c
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 a6d812c

Please sign in to comment.