react-native-onyx 3.0.24 → 3.0.25
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.
- package/dist/useOnyx.js +2 -1
- package/package.json +1 -1
package/dist/useOnyx.js
CHANGED
|
@@ -239,8 +239,9 @@ function useOnyx(key, options, dependencies = []) {
|
|
|
239
239
|
// - The previously cached value is different from the new value.
|
|
240
240
|
// - The previously cached value is `null` (not set from cache yet) and we have cache for this key
|
|
241
241
|
// OR we have a pending `Onyx.clear()` task (if `Onyx.clear()` is running cache might not be available anymore
|
|
242
|
+
// OR the subscriber is triggered (the value is gotten from the storage)
|
|
242
243
|
// so we update the cached value/result right away in order to prevent infinite loading state issues).
|
|
243
|
-
const shouldUpdateResult = !areValuesEqual || (previousValueRef.current === null && (hasCacheForKey || OnyxCache_1.default.hasPendingTask(OnyxCache_1.TASK.CLEAR)));
|
|
244
|
+
const shouldUpdateResult = !areValuesEqual || (previousValueRef.current === null && (hasCacheForKey || OnyxCache_1.default.hasPendingTask(OnyxCache_1.TASK.CLEAR) || !isFirstConnectionRef.current));
|
|
244
245
|
if (shouldUpdateResult) {
|
|
245
246
|
previousValueRef.current = newValueRef.current;
|
|
246
247
|
// If the new value is `null` we default it to `undefined` to ensure the consumer gets a consistent result from the hook.
|