Skip to content

Commit

Permalink
Merge pull request #498 from Expensify/revert-480-fix/falsey-value-is…
Browse files Browse the repository at this point in the history
…-ignored

Revert "Re: Use initialValue when cached value is undefined"
  • Loading branch information
roryabraham authored Mar 5, 2024
2 parents a489f47 + 8c9e9f2 commit 3e9b790
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion lib/withOnyx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 0 additions & 5 deletions tests/unit/withOnyxTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,6 @@ describe('withOnyxTest', () => {
key: ONYX_KEYS.SIMPLE_KEY,
initialValue: 'initialValue',
},
simple2: {
key: ONYX_KEYS.SIMPLE_KEY_2,
initialValue: false,
},
})(ViewWithCollections);
render(
<TestComponentWithOnyx
Expand All @@ -582,7 +578,6 @@ describe('withOnyxTest', () => {
onRender,
testObject: {isDefaultProp: true},
simple: 'initialValue',
simple2: false,
});
});
});
Expand Down

0 comments on commit 3e9b790

Please sign in to comment.