From 8c9e9f21bf1faa3baf0899df123098091ddcd06d Mon Sep 17 00:00:00 2001 From: Tim Golen Date: Tue, 5 Mar 2024 15:38:18 -0700 Subject: [PATCH] Revert "Re: Use initialValue when cached value is undefined" --- lib/withOnyx.js | 2 +- tests/unit/withOnyxTest.js | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/withOnyx.js b/lib/withOnyx.js index 46971a39..2d91424c 100644 --- a/lib/withOnyx.js +++ b/lib/withOnyx.js @@ -59,7 +59,7 @@ export default function (mapOnyxToState, shouldDelayUpdates = false) { (resultObj, mapping, propertyName) => { const key = Str.result(mapping.key, props); let value = Onyx.tryGetCachedValue(key, mapping); - if (value === undefined) { + if (!value && mapping.initialValue) { value = mapping.initialValue; } diff --git a/tests/unit/withOnyxTest.js b/tests/unit/withOnyxTest.js index bf8724f2..6f6eba37 100644 --- a/tests/unit/withOnyxTest.js +++ b/tests/unit/withOnyxTest.js @@ -561,10 +561,6 @@ describe('withOnyxTest', () => { key: ONYX_KEYS.SIMPLE_KEY, initialValue: 'initialValue', }, - simple2: { - key: ONYX_KEYS.SIMPLE_KEY_2, - initialValue: false, - }, })(ViewWithCollections); render( { onRender, testObject: {isDefaultProp: true}, simple: 'initialValue', - simple2: false, }); }); });