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

Bump Onyx to 1.0.100 #28894

Merged
merged 19 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
"react-collapse": "^5.1.0",
"react-content-loader": "^6.1.0",
"react-dom": "18.1.0",
"react-map-gl": "^7.1.3",
"react-error-boundary": "^4.0.11",
"react-map-gl": "^7.1.3",
"react-native": "0.72.4",
"react-native-android-location-enabler": "^1.2.2",
"react-native-blob-util": "^0.17.3",
Expand All @@ -137,7 +137,7 @@
"react-native-linear-gradient": "^2.8.1",
"react-native-localize": "^2.2.6",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.98",
"react-native-onyx": "^1.0.100",
chrispader marked this conversation as resolved.
Show resolved Hide resolved
"react-native-pager-view": "^6.2.0",
"react-native-pdf": "^6.7.1",
"react-native-performance": "^5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/libs/EmojiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ function suggestEmojis(text, lang, limit = CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMO
* @returns {Number}
*/
const getPreferredSkinToneIndex = (val) => {
if (!_.isNull(val) && Number.isInteger(Number(val))) {
if (!_.isNull(val) && _.isUndefined(val) && Number.isInteger(Number(val))) {
chrispader marked this conversation as resolved.
Show resolved Hide resolved
return val;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priority
const unsubscribeOnyxModal = onyxSubscribe({
key: ONYXKEYS.MODAL,
callback: (modalArg) => {
if (_.isNull(modalArg)) {
if (_.isNull(modalArg) || _.isUndefined(modalArg)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to check if modalArg is not what we are looking for instead of checking if it's something we are not looking for (null, undefined, etc).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean it like this?

Maybe it would be better to check if modalArg is what we are looking for instead of checking if it's something we are not looking for (null, undefined, etc).

If so, what would it be that we're looking for. I think it's better to just early-return in case of nullish values.

If not, what do you mean by that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant something like - is it supposed to be a string? If so, then neither null or undefined are String

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, got it! Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, ONYXKEYS.MODAL is an object, so we'll still have to check for null, because null is treated as type object

return;
}
modal.current = modalArg;
Expand Down
14 changes: 7 additions & 7 deletions tests/actions/IOUTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ describe('actions/IOU', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1647,7 +1647,7 @@ describe('actions/IOU', () => {

// Then check the loading state of our action
const resultActionAfterUpdate = reportActions[reportActionID];
expect(resultActionAfterUpdate.pendingAction).toBeNull();
expect(resultActionAfterUpdate.pendingAction).toBeUndefined();

// When we attempt to delete a money request from the IOU report
fetch.pause();
Expand Down Expand Up @@ -1818,7 +1818,7 @@ describe('actions/IOU', () => {
// Then the report should have 2 actions
expect(_.size(reportActions)).toBe(2);
const resultActionAfter = reportActions[reportActionID];
expect(resultActionAfter.pendingAction).toBeNull();
expect(resultActionAfter.pendingAction).toBeUndefined();

fetch.pause();
// When deleting money request
Expand Down Expand Up @@ -1903,7 +1903,7 @@ describe('actions/IOU', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1913,7 +1913,7 @@ describe('actions/IOU', () => {
let resultActionAfterUpdate = reportActions[reportActionID];

// Verify that our action is no longer in the loading state
expect(resultActionAfterUpdate.pendingAction).toBeNull();
expect(resultActionAfterUpdate.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1935,7 +1935,7 @@ describe('actions/IOU', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1945,7 +1945,7 @@ describe('actions/IOU', () => {
resultActionAfterUpdate = reportActions[reportActionID];

// Verify that our action is no longer in the loading state
expect(resultActionAfterUpdate.pendingAction).toBeNull();
expect(resultActionAfterUpdate.pendingAction).toBeUndefined();

fetch.pause();
// When we delete the money request
Expand Down
10 changes: 5 additions & 5 deletions tests/actions/ReportTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('actions/Report', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

// We subscribed to the Pusher channel above and now we need to simulate a reportComment action
// Pusher event so we can verify that action was handled correctly and merged into the reportActions.
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('actions/Report', () => {
const resultAction = reportActions[reportActionID];

// Verify that our action is no longer in the loading state
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();
});
});

Expand Down Expand Up @@ -608,7 +608,7 @@ describe('actions/Report', () => {
// Expect the reaction to have null where the users reaction used to be
expect(reportActionsReactions).toHaveProperty(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`);
const reportActionReaction = reportActionsReactions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`];
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeNull();
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeUndefined();
})
.then(() => {
reportAction = _.first(_.values(reportActions));
Expand Down Expand Up @@ -650,7 +650,7 @@ describe('actions/Report', () => {
// Expect the reaction to have null where the users reaction used to be
expect(reportActionsReactions).toHaveProperty(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`);
const reportActionReaction = reportActionsReactions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`];
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeNull();
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeUndefined();
});
});
});
Expand Down Expand Up @@ -717,7 +717,7 @@ describe('actions/Report', () => {
// Expect the reaction to have null where the users reaction used to be
expect(reportActionsReactions).toHaveProperty(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${resultAction.reportActionID}`);
const reportActionReaction = reportActionsReactions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${resultAction.reportActionID}`];
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeNull();
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeUndefined();
});
});
});
24 changes: 9 additions & 15 deletions tests/unit/MigrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,12 @@ describe('Migrations', () => {
})
.then(PersonalDetailsByAccountID)
.then(() => {
expect(LogSpy).toHaveBeenCalledWith(
`[Migrate Onyx] Skipped migration PersonalDetailsByAccountID for ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1 because there were no reportActions`,
);
expect(LogSpy).toHaveBeenCalledWith(
`[Migrate Onyx] Skipped migration PersonalDetailsByAccountID for ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2 because there were no reportActions`,
);
const connectionID = Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (allReportActions) => {
Onyx.disconnect(connectionID);
_.each(allReportActions, (reportActionsForReport) => expect(reportActionsForReport).toBeNull());
_.each(allReportActions, (reportActionsForReport) => expect(reportActionsForReport).toBeUndefined());
},
});
}));
Expand Down Expand Up @@ -377,8 +371,8 @@ describe('Migrations', () => {
waitForCollectionCallback: true,
callback: (allPolicyMemberLists) => {
Onyx.disconnect(connectionID);
expect(allPolicyMemberLists[`${ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}1`]).toBeNull();
expect(allPolicyMemberLists[`${ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}2`]).toBeNull();

expect(allPolicyMemberLists).toBeFalsy();
},
});
}));
Expand Down Expand Up @@ -554,8 +548,8 @@ describe('Migrations', () => {
Onyx.disconnect(connectionID);
const expectedReportAction = {};
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toMatchObject(expectedReportAction);
},
});
Expand Down Expand Up @@ -597,8 +591,8 @@ describe('Migrations', () => {
},
};
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toMatchObject(expectedReportAction1);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toMatchObject(expectedReportAction4);
},
});
Expand All @@ -620,10 +614,10 @@ describe('Migrations', () => {
callback: (allReportActions) => {
Onyx.disconnect(connectionID);
const expectedReportAction = {};
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toBeUndefined();
},
});
}));
Expand Down
Loading