Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Expensify/react-native-onyx into fi…
Browse files Browse the repository at this point in the history
…x/set-callback-not-called-for-keys-with-underscore3
  • Loading branch information
hannojg committed Aug 7, 2024
2 parents 8de1447 + 115542b commit 5053379
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.14.0
20.15.1
2 changes: 2 additions & 0 deletions lib/OnyxUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ function deleteKeyByConnections(connectionID: number) {
const updatedConnectionIDs = onyxKeyToConnectionIDs.get(subscriber.key).filter((id: number) => id !== connectionID);
onyxKeyToConnectionIDs.set(subscriber.key, updatedConnectionIDs);
}

lastConnectionCallbackData.delete(connectionID);
}

/** Returns current key names stored in persisted storage */
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-onyx",
"version": "2.0.58",
"version": "2.0.61",
"author": "Expensify, Inc.",
"homepage": "https://expensify.com",
"description": "State management for React Native",
Expand Down Expand Up @@ -111,7 +111,7 @@
}
},
"engines": {
"node": ">=20.14.0",
"node": ">=20.15.1",
"npm": ">=10.7.0"
},
"sideEffects": false
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/onyxTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ describe('Onyx', () => {
})
.then((keys) => {
expect(keys.has(ONYX_KEYS.OTHER_TEST)).toBe(false);
})
// Expect to reset to initial key value when calling Onyx.clear()
}));

it('should restore a key with initial state if the key was set to null and Onyx.clear() is called', () =>
Onyx.set(ONYX_KEYS.OTHER_TEST, 42)
.then(() => Onyx.set(ONYX_KEYS.OTHER_TEST, null))
.then(() => Onyx.clear())
.then(() => {
expect(cache.get(ONYX_KEYS.OTHER_TEST)).toBe(42);
Expand Down

0 comments on commit 5053379

Please sign in to comment.