Skip to content

Commit a6d812c

Browse files
authored
Merge pull request Expensify#48057 from margelo/fix/optimistic-read-updates
fix: apply optimistic updates from READ requests immediately
2 parents 526845b + c52bc36 commit a6d812c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libs/API/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ function waitForWrites<TCommand extends ReadCommand>(command: TCommand) {
181181
function read<TCommand extends ReadCommand>(command: TCommand, apiCommandParameters: ApiRequestCommandParameters[TCommand], onyxData: OnyxData = {}): void {
182182
Log.info('[API] Called API.read', false, {command, ...apiCommandParameters});
183183

184+
// Apply optimistic updates of read requests immediately
185+
const request = prepareRequest(command, CONST.API_REQUEST_TYPE.READ, apiCommandParameters, onyxData);
184186
waitForWrites(command).then(() => {
185-
const request = prepareRequest(command, CONST.API_REQUEST_TYPE.READ, apiCommandParameters, onyxData);
186187
processRequest(request, CONST.API_REQUEST_TYPE.READ);
187188
});
188189
}

0 commit comments

Comments
 (0)