react-native-onyx 2.0.97 → 2.0.98

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.
Files changed (2) hide show
  1. package/dist/useOnyx.js +3 -2
  2. package/package.json +1 -1
package/dist/useOnyx.js CHANGED
@@ -193,8 +193,9 @@ function useOnyx(key, options, dependencies = []) {
193
193
  const newStatus = newFetchStatus !== null && newFetchStatus !== void 0 ? newFetchStatus : 'loaded';
194
194
  resultRef.current = [(_c = previousValueRef.current) !== null && _c !== void 0 ? _c : undefined, { status: newStatus }];
195
195
  // If `canBeMissing` is set to `false` and the Onyx value of that key is not defined,
196
- // we log an alert so it can be acknowledged by the consumer.
197
- if ((options === null || options === void 0 ? void 0 : options.canBeMissing) === false && newStatus === 'loaded' && !isOnyxValueDefined) {
196
+ // we log an alert so it can be acknowledged by the consumer. Additionally, we won't log alerts
197
+ // if there's a `Onyx.clear()` task in progress.
198
+ if ((options === null || options === void 0 ? void 0 : options.canBeMissing) === false && newStatus === 'loaded' && !isOnyxValueDefined && !OnyxCache_1.default.hasPendingTask(OnyxCache_1.TASK.CLEAR)) {
198
199
  Logger.logAlert(`useOnyx returned no data for key with canBeMissing set to false.`, { key, showAlert: true });
199
200
  }
200
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "2.0.97",
3
+ "version": "2.0.98",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",