Skip to content

Commit

Permalink
Merge pull request #24003 from Expensify/beaman-revertOnyxDirectCache…
Browse files Browse the repository at this point in the history
…Access

[CP Staging] [Revert] Perf/onyx upgrade use cache directly

(cherry picked from commit a3c2e1b)
  • Loading branch information
cristipaval authored and OSBotify committed Aug 1, 2023
1 parent 3085a80 commit c854b6b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"react-native-key-command": "^1.0.1",
"react-native-localize": "^2.2.6",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.56",
"react-native-onyx": "1.0.52",
"react-native-pdf": "^6.6.2",
"react-native-performance": "^4.0.0",
"react-native-permissions": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/QueuedOnyxUpdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Onyx.connect({
* @returns {Promise}
*/
function queueOnyxUpdates(updates) {
return Onyx.set(ONYXKEYS.QUEUED_ONYX_UPDATES, [...queuedOnyxUpdates, ...updates]);
return Onyx.merge(ONYXKEYS.QUEUED_ONYX_UPDATES, updates);
}

function clear() {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/EmojiTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('EmojiTest', () => {
lastUpdatedAt: 1,
},
];
Onyx.set(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);
Onyx.merge(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);

return waitForPromisesToResolve().then(() => {
// When add a new emoji
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('EmojiTest', () => {
},
{...smileEmoji, count: 1, lastUpdatedAt: 1},
];
Onyx.set(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);
Onyx.merge(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);

return waitForPromisesToResolve().then(() => {
// When add multiple emojis that either exist or not exist in the list
Expand Down Expand Up @@ -464,7 +464,7 @@ describe('EmojiTest', () => {
{...bookEmoji, count: 3, lastUpdatedAt: 1},
];
expect(frequentlyEmojisList.length).toBe(CONST.EMOJI_FREQUENT_ROW_COUNT * CONST.EMOJI_NUM_PER_ROW);
Onyx.set(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);
Onyx.merge(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);

return waitForPromisesToResolve().then(() => {
// When add new emojis
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/SidebarOrderTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ describe('Sidebar', () => {
})

// When the draft is removed
.then(() => Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, {hasDraft: false}))
.then(() => Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, {hasDraft: null}))

// Then the pencil icon goes away
.then(() => {
expect(screen.queryAllByTestId('Pencil Icon')).toHaveLength(0);
Expand Down

0 comments on commit c854b6b

Please sign in to comment.