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

[$250] Group - App crash when removing a member on the process splitting expense #46805

Closed
3 of 6 tasks
izarutskaya opened this issue Aug 5, 2024 · 33 comments
Closed
3 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 5, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.0.16-4
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): [email protected]
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. As User A Create a group chat with User B While viewing both accounts
  2. go to user B > navigate to the group chat created
  3. Click on the + button on the composer box > Split Expense
  4. Enter amount > Click next. Don't finish the flow
  5. As User A,While User B is the confirmation page, remove user B from the group.

Expected Result:

Error is shown

Actual Result:

App Crash

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6562221.1722857270352.Screen.Recording.2024-08-05.At.1.56.25.Pm.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013d4e761b19949e81
  • Upwork Job ID: 1820614678720926546
  • Last Price Increase: 2024-08-06
  • Automatic offers:
    • ishpaul777 | Contributor | 103413818
Issue OwnerCurrent Issue Owner: @RachCHopkins
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Aug 5, 2024
Copy link

melvin-bot bot commented Aug 5, 2024

Triggered auto assignment to @cristipaval (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Aug 5, 2024

Triggered auto assignment to @RachCHopkins (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Copy link
Contributor

github-actions bot commented Aug 5, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Aug 5, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@daledah
Copy link
Contributor

daledah commented Aug 5, 2024

Edited by proposal-police: This proposal was edited at 2024-08-06 04:08:22 UTC.

Proposal

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

App Crash

What is the root cause of that problem?

we use useOnyx to get policy In

const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID || -1}`);

When user A add user B from group, the report?.policyId is _FAKE_ -> we get policy__FALE_
when A remove B, report?.report will be undefined -> we get policy_-1

In we have the logic to detect if policy__FALE_ and policy_-1 have the same collection key

https://github.com/Expensify/react-native-onyx/blob/115542b601349d13114bf6784f645e44c02816d1/lib/useOnyx.ts#L112

But the logic to extract the collection key (splitCollectionMemberKey) is wrong

https://github.com/Expensify/react-native-onyx/blob/115542b601349d13114bf6784f645e44c02816d1/lib/OnyxUtils.ts#L409

we're using lastIndexOf to get the index of _ -> the collection key of policy__FALE_ is policy__FALE_
the collection key of policy_-1 is policy_

-> the condition is failed

-> the error is throw here

https://github.com/Expensify/react-native-onyx/blob/115542b601349d13114bf6784f645e44c02816d1/lib/useOnyx.ts#L121-L123

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

Create usePolicy hook to handle the policyID-defaulting logic

 const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report.policyID === CONST.POLICY.OWNER_EMAIL_FAKE ? '-1' : report.policyID ?? '-1'}`); 

What alternative solutions did you explore? (Optional)

@daledah
Copy link
Contributor

daledah commented Aug 5, 2024

@cristipaval I can raise the PR soon if you agree with the solution. Thanks

@ishpaul777
Copy link
Contributor

ishpaul777 commented Aug 5, 2024

We should use indexOf instead of lastIndexOf

@daledah Wouldn't that restrict the collection key to not use _ in between ? for ex. a_collection_key (i dont think this is relevant for our App right now, but that's for sure a restriction if we do this)

@roryabraham roryabraham removed the DeployBlocker Indicates it should block deploying the API label Aug 5, 2024
@roryabraham
Copy link
Contributor

@daledah as @ishpaul777 pointed out, your proposal would not work in cases when there is an underscore in the collection key base, such as for the POLICY_RECENTLY_USED_TAGS key:

POLICY_RECENTLY_USED_TAGS: 'nvp_recentlyUsedTags_',

@roryabraham
Copy link
Contributor

I think more simply we should just audit all uses of useOnyx with the policy collection key and do something like this:

const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report.policyID === CONST.POLICY.OWNER_EMAIL_FAKE ? '-1' : report.policyID ?? '-1'}`);

Maybe we can create a utility hook like usePolicy that handles that policyID-defaulting logic.

@ishpaul777 ishpaul777 mentioned this issue Aug 5, 2024
50 tasks
@marcaaron marcaaron added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 6, 2024
@marcaaron
Copy link
Contributor

Gonna demote this one since it's kind of an edge case. Sounds like @ishpaul777 is on the right track though.

@marcaaron marcaaron added the External Added to denote the issue can be worked on by a contributor label Aug 6, 2024
Copy link

melvin-bot bot commented Aug 6, 2024

Job added to Upwork: https://www.upwork.com/jobs/~013d4e761b19949e81

@melvin-bot melvin-bot bot changed the title Group - App crash when removing a member on the process splitting expense [$250] Group - App crash when removing a member on the process splitting expense Aug 6, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 6, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Aug 7, 2024
@daledah
Copy link
Contributor

daledah commented Aug 7, 2024

@ishpaul777 this PR is ready for review.

Copy link

melvin-bot bot commented Aug 30, 2024

This issue has not been updated in over 15 days. @cristipaval, @RachCHopkins, @ishpaul777, @daledah eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Aug 30, 2024
@ishpaul777
Copy link
Contributor

This is ready for payment 🎉

@roryabraham
Copy link
Contributor

confirmed, this has been on prod for more than a week

@roryabraham roryabraham added Daily KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review Monthly KSv2 labels Sep 4, 2024
@RachCHopkins
Copy link
Contributor

Sorry @daledah did you apply for the upwork job per this comment? I do see one shortlisted proposal but I'm not 100% sure it's you.

@melvin-bot melvin-bot bot removed the Overdue label Sep 9, 2024
@RachCHopkins
Copy link
Contributor

Ok, no it's not, I found your upwork profile and that is not you. I will set up the job again and send you another offer @daledah

@ishpaul777 forgive me if this is a silly question - did you get paid for this offer?

@ishpaul777
Copy link
Contributor

@ishpaul777 forgive me if this is a silly question - did you get paid for this offer?

Yes thats the offer i accepted, here's the contract https://www.upwork.com/nx/wm/workroom/38035610

@RachCHopkins
Copy link
Contributor

What I mean is, did you get paid money for it @ishpaul777 ?

@ishpaul777
Copy link
Contributor

What I mean is, did you get paid money for it @ishpaul777 ?

No, on automatic offers A BZ member need to release payment manually when the payment is due, i.e. 7 days after PR deplyed to Prod.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Sep 10, 2024
@RachCHopkins
Copy link
Contributor

Thanks for confirmation @ishpaul777 - I was looking at totally the wrong page! I've paid that out.

@daledah I'm just waiting on you to accept the proposal (and two others) so I can pay you.

@RachCHopkins
Copy link
Contributor

RachCHopkins commented Sep 12, 2024

Payment Summary:

  • Contributor: @daledah to be paid $250 via Upwork - Update: Paid 16 Sept
  • Contributor+: @ishpaul777 paid $250 via Upwork

Upwork job here

@melvin-bot melvin-bot bot added the Overdue label Sep 16, 2024
@RachCHopkins
Copy link
Contributor

Contributor has been paid, the contract has been completed, and the Upwork post has been closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants