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

[$1000] [Onyx re-key] Prop type warnings / errors #20802

Closed
Beamanator opened this issue Jun 15, 2023 · 20 comments
Closed

[$1000] [Onyx re-key] Prop type warnings / errors #20802

Beamanator opened this issue Jun 15, 2023 · 20 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Reviewing Has a PR in review

Comments

@Beamanator
Copy link
Contributor

Beamanator commented Jun 15, 2023

Here I'll list a few places people have reported proptypes being incorrect:

This only occurs in main for now, but we should get it fixed soon

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0144288ee67ea3d1ae
  • Upwork Job ID: 1676295377429790720
  • Last Price Increase: 2023-07-04
@Beamanator Beamanator added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

Triggered auto assignment to @NicMendonca (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@Beamanator Beamanator changed the title [Onyx re-key] Prop type warnings [Onyx re-key] Prop type warnings / errors Jun 15, 2023
@alitoshmatov
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

[Onyx re-key] Prop type warnings / errors

What is the root cause of that problem?

Before accountID from personalDetails was number, now it is string in personalDetailsList in several places, for example:

accountID: PropTypes.number,

Screenshot 2023-06-15 at 4 55 11 PM

What changes do you think we should make in order to solve the problem?

We should update propTypes of every effected components, changing accountID from number to string

What alternative solutions did you explore? (Optional)

@NicMendonca
Copy link
Contributor

@Beamanator what should I be doing with this one? 👀

@Beamanator Beamanator self-assigned this Jun 19, 2023
@Beamanator
Copy link
Contributor Author

haha good question 😬 I think we can keep this open for a bit, but hopefully soon all of these will be resolved - I'll assign myself too to keep an eye out

@NicMendonca
Copy link
Contributor

@Beamanator heads up I am going OOO until Wednesday. Please re-assign if action is required before then. Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Jun 30, 2023

@Beamanator, @NicMendonca Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@NicMendonca
Copy link
Contributor

@Beamanator anything needed from me here yet?

@Beamanator
Copy link
Contributor Author

@NicMendonca I think we should be able to get 1 external person to audit the app & see if all of the above reported console errors are fixed - if not, spin up a PR to fix them 👍

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Jul 4, 2023
@melvin-bot melvin-bot bot changed the title [Onyx re-key] Prop type warnings / errors [$1000] [Onyx re-key] Prop type warnings / errors Jul 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 4, 2023

Job added to Upwork: https://www.upwork.com/jobs/~0144288ee67ea3d1ae

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 4, 2023

Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 4, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

@alexxxwork
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

We get some prop type warnings / errors

What is the root cause of that problem?

accountID should be of type Number and there are some places in code when it is of type String

What changes do you think we should make in order to solve the problem?

We should change propTypes to Number here

* @param {String} accountID

because this func uses accountID from Onyx here:
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (val) => {
currentUserAccountID = lodashGet(val, 'accountID', -1);
currentEmail = lodashGet(val, 'email', '');
},
});

PusherUtils.subscribeToPrivateUserChannelEvent(Pusher.TYPE.MULTIPLE_EVENTS, currentUserAccountID, (pushJSON) => {
_.each(pushJSON, (multipleEvent) => {
PusherUtils.triggerMultiEventHandler(multipleEvent.eventType, multipleEvent.data);
});
});

and we should explicitly convert accountID to Number when it is passed as a string from route params:
useEffect(() => {
const login = lodashGet(props, 'credentials.login', null);
const accountID = lodashGet(props.route.params, 'accountID', '');
const validateCode = lodashGet(props.route.params, 'validateCode', '');
// A fresh session will not have credentials.login and user permission betas available.
// In that case, we directly allow users to go through password less flow
if (!login || canUsePasswordlessLogins) {
if (lodashGet(props, 'session.authToken')) {
// If already signed in, do not show the validate code if not on web,
// because we don't want to block the user with the interstitial page.
Navigation.goBack(false);
} else {
Session.signInWithValidateCodeAndNavigate(accountID, validateCode, preferredLocale);
}
} else {
User.validateLogin(accountID, validateCode);

accountID is string here:
accountID: PropTypes.string,

also here func params should be described properly and should be of type Number because selectedEmployees is an array of Number
/**
* Add user from the selectedEmployees list
*
* @param {String} login
*/
const addUser = useCallback(
(accountID) => {
setSelectedEmployees((prevSelected) => [...prevSelected, accountID]);
validateSelection();
},
[validateSelection],
);
/**
* Remove user from the selectedEmployees list
*
* @param {String} login
*/
const removeUser = useCallback(
(accountID) => {
setSelectedEmployees((prevSelected) => _.without(prevSelected, accountID));
validateSelection();
},
[validateSelection],
);

and we should convert to Number here:
removeUser(accountID);
} else {
addUser(accountID);

@mananjadhav
Copy link
Collaborator

@NicMendonca I think we should be able to get 1 external person to audit the app & see if all of the above reported console errors are fixed - if not, spin up a PR to fix them 👍

@Beamanator Is this like an investigation + fix? Because I can see proposals but I don't see any investigations?

@Beamanator
Copy link
Contributor Author

@mananjadhav - yeah i think investigation just to the point of "does this proptype error still exist" & if it does, recommend the fix

@alexxxwork
Copy link
Contributor

@Beamanator @mananjadhav All of the mentioned cases of console errors are now resolved

@Beamanator
Copy link
Contributor Author

Okkk thanks @alexxxwork - if you see other cases please feel free to report in #expensify-bugs - for now let's close!

@kbecciv
Copy link

kbecciv commented Jul 12, 2023

Hello @Beamanator! There is another console error when requesting money. Let me know if I need to open a separate ticket for that. Thank you

image

@kbecciv kbecciv reopened this Jul 12, 2023
@Beamanator
Copy link
Contributor Author

@kbecciv yes please create a different issue, this specific issue deals with a different type of console error (unrelated to what you found) 👍

@kbecciv
Copy link

kbecciv commented Jul 12, 2023

Sound good @Beamanator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

6 participants