From 23a2fd8db7518274887654351e686e2cd018fbc6 Mon Sep 17 00:00:00 2001 From: Benjamin Limpich Date: Tue, 27 Feb 2024 09:02:11 -0800 Subject: [PATCH] Revert "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, }); }); });