Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/libs/actions/OnyxUpdates.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {OnyxUpdate} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {Merge} from 'type-fest';
import {READ_COMMANDS, SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import {SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import Log from '@libs/Log';
import Performance from '@libs/Performance';
import PusherUtils from '@libs/PusherUtils';
Expand Down Expand Up @@ -38,18 +38,7 @@ function applyHTTPSOnyxUpdates(request: Request, response: Response, lastUpdateI
// First apply any onyx data updates that are being sent back from the API. We wait for this to complete and then
// apply successData or failureData. This ensures that we do not update any pending, loading, or other UI states contained
// in successData/failureData until after the component has received and API data.
const onyxDataUpdatePromise = response.onyxData
? updateHandler(response.onyxData).catch((error: unknown) => {
// Sometimes we get a SQL error here if the previous queued write failed. In that case, we want to still apply the Onyx update
// This is temporary fix until we can identify what causes SQL errors. Ideally we would only like to catch errors here.
// Related issue - https://github.com/Expensify/App/issues/69808
if (String(error).includes('[SqlExecutionError]') && request.command === READ_COMMANDS.OPEN_UNREPORTED_EXPENSES_PAGE && response.onyxData !== undefined) {
Log.warn(`${String(error)}, retrying Onyx update`);
return updateHandler(response.onyxData);
}
Log.warn(String(error));
})
: Promise.resolve();
const onyxDataUpdatePromise = response.onyxData ? updateHandler(response.onyxData) : Promise.resolve();

return onyxDataUpdatePromise
.then(() => {
Expand Down
Loading