Skip to content

Commit c4d29dc

Browse files
committed
Applied feedback
1 parent 6fc70ed commit c4d29dc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/OnyxUtils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ const METHOD = {
4949
CLEAR: 'clear',
5050
} as const;
5151

52+
const IDB_STORAGE_ERRORS = ['quotaexceedederror'] as const;
53+
const SQL_STORAGE_ERRORS = ['database or disk is full', 'disk I/O error', 'out of memory'] as const;
54+
const STORAGE_ERRORS = [...IDB_STORAGE_ERRORS, ...SQL_STORAGE_ERRORS];
55+
5256
type OnyxMethod = ValueOf<typeof METHOD>;
5357

5458
// Key/value store of Onyx key and arrays of values to merge
@@ -876,8 +880,7 @@ function retryOperation<TMethod extends typeof Onyx.set | typeof Onyx.multiSet |
876880
}
877881

878882
const errorMessage = error?.message?.toLowerCase?.();
879-
const storageErrors = ['quotaexceedederror', 'database or disk is full', 'disk I/O error', 'out of memory'];
880-
const isStorageCapacityError = storageErrors.includes(error?.name?.toLowerCase()) || storageErrors.some((message) => errorMessage?.includes(message));
883+
const isStorageCapacityError = STORAGE_ERRORS.some((storageError) => storageError === error?.name?.toLowerCase() || errorMessage?.includes(storageError));
881884

882885
if (!isStorageCapacityError) {
883886
// @ts-expect-error No overload matches this call.

0 commit comments

Comments
 (0)