Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] Perf/onyx upgrade use cache directly #23749

Merged
merged 11 commits into from
Jul 28, 2023
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 @@ -115,7 +115,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
Loading