Skip to content

Commit

Permalink
Merge pull request #23749 from margelo/perf/onyx-upgrade-use-cache-di…
Browse files Browse the repository at this point in the history
…rectly

[NoQA] Perf/onyx upgrade use cache directly
  • Loading branch information
mountiny authored Jul 28, 2023
2 parents 28557e1 + eec6676 commit 28644a5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 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.52",
"react-native-onyx": "1.0.56",
"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.merge(ONYXKEYS.QUEUED_ONYX_UPDATES, updates);
return Onyx.set(ONYXKEYS.QUEUED_ONYX_UPDATES, [...queuedOnyxUpdates, ...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.merge(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);
Onyx.set(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.merge(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);
Onyx.set(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.merge(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);
Onyx.set(ONYXKEYS.FREQUENTLY_USED_EMOJIS, frequentlyEmojisList);

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

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

.then(() => Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, {hasDraft: false}))
// Then the pencil icon goes away
.then(() => {
expect(screen.queryAllByTestId('Pencil Icon')).toHaveLength(0);
Expand Down

0 comments on commit 28644a5

Please sign in to comment.