react-native-onyx 3.0.67 → 3.0.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -135,7 +135,7 @@ declare function getCollectionDataAndSendAsObject<TKey extends OnyxKey>(matching
135
135
  * Remove a key from Onyx and update the subscribers
136
136
  */
137
137
  declare function remove<TKey extends OnyxKey>(key: TKey, isProcessingCollectionUpdate?: boolean): Promise<void>;
138
- declare function reportStorageQuota(): Promise<void>;
138
+ declare function reportStorageQuota(error?: Error): Promise<void>;
139
139
  /**
140
140
  * Handles storage operation failures based on the error type:
141
141
  * - Storage capacity errors: evicts data and retries the operation
package/dist/OnyxUtils.js CHANGED
@@ -633,13 +633,13 @@ function remove(key, isProcessingCollectionUpdate) {
633
633
  }
634
634
  return storage_1.default.removeItem(key).then(() => undefined);
635
635
  }
636
- function reportStorageQuota() {
636
+ function reportStorageQuota(error) {
637
637
  return storage_1.default.getDatabaseSize()
638
638
  .then(({ bytesUsed, bytesRemaining }) => {
639
- Logger.logInfo(`Storage Quota Check -- bytesUsed: ${bytesUsed} bytesRemaining: ${bytesRemaining}`);
639
+ Logger.logInfo(`Storage Quota Check -- bytesUsed: ${bytesUsed} bytesRemaining: ${bytesRemaining}. Original error: ${error}`);
640
640
  })
641
641
  .catch((dbSizeError) => {
642
- Logger.logAlert(`Unable to get database size. Error: ${dbSizeError}`);
642
+ Logger.logAlert(`Unable to get database size. getDatabaseSize error: ${dbSizeError}. Original error: ${error}`);
643
643
  });
644
644
  }
645
645
  /**
@@ -654,7 +654,7 @@ function retryOperation(error, onyxMethod, defaultParams, retryAttempt) {
654
654
  const nextRetryAttempt = currentRetryAttempt + 1;
655
655
  Logger.logInfo(`Failed to save to storage. Error: ${error}. onyxMethod: ${onyxMethod.name}. retryAttempt: ${currentRetryAttempt}/${MAX_STORAGE_OPERATION_RETRY_ATTEMPTS}`);
656
656
  if (error && Str.startsWith(error.message, "Failed to execute 'put' on 'IDBObjectStore'")) {
657
- Logger.logAlert('Attempted to set invalid data set in Onyx. Please ensure all data is serializable.');
657
+ Logger.logAlert(`Attempted to set invalid data set in Onyx. Please ensure all data is serializable. Error: ${error}`);
658
658
  throw error;
659
659
  }
660
660
  const errorMessage = (_b = (_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a);
@@ -674,12 +674,12 @@ function retryOperation(error, onyxMethod, defaultParams, retryAttempt) {
674
674
  // If we have no acceptable keys to remove then we are possibly trying to save mission critical data. If this is the case,
675
675
  // then we should stop retrying as there is not much the user can do to fix this. Instead of getting them stuck in an infinite loop we
676
676
  // will allow this write to be skipped.
677
- Logger.logAlert('Out of storage. But found no acceptable keys to remove.');
678
- return reportStorageQuota();
677
+ Logger.logAlert(`Out of storage. But found no acceptable keys to remove. Error: ${error}`);
678
+ return reportStorageQuota(error);
679
679
  }
680
680
  // Remove the least recently accessed key and retry.
681
- Logger.logInfo(`Out of storage. Evicting least recently accessed key (${keyForRemoval}) and retrying.`);
682
- reportStorageQuota();
681
+ Logger.logInfo(`Out of storage. Evicting least recently accessed key (${keyForRemoval}) and retrying. Error: ${error}`);
682
+ reportStorageQuota(error);
683
683
  // @ts-expect-error No overload matches this call.
684
684
  return remove(keyForRemoval).then(() => onyxMethod(defaultParams, nextRetryAttempt));
685
685
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "3.0.67",
3
+ "version": "3.0.68",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",