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

[HOLD for payment 2024-11-14] [$250] Split - App crashes when opening user profile from split preview RHP offline then online #50786

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

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 15, 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: 9.0.49-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5083991
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go offline.
  3. Create a group chat with users that have no chat history.
  4. Split an expense.
  5. Click on the split preview.
  6. Click on any split participant to open the profile.
  7. Go online.
  8. Wait until it crashes.

Expected Result:

App will not crash.

Actual Result:

App crashes.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6635031_1728983494310.20241015_170501.mp4

1510_1.txt

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021846204527381661299
  • Upwork Job ID: 1846204527381661299
  • Last Price Increase: 2024-10-22
  • Automatic offers:
    • alitoshmatov | Reviewer | 104617499
    • nkdengineer | Contributor | 104617500
Issue OwnerCurrent Issue Owner: @alitoshmatov
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 15, 2024
Copy link

melvin-bot bot commented Oct 15, 2024

Triggered auto assignment to @puneetlath (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.

@IuliiaHerets
Copy link
Author

@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@nkdengineer
Copy link
Contributor

nkdengineer commented Oct 15, 2024

Edited by proposal-police: This proposal was edited at 2024-10-15 10:05:56 UTC.

Proposal

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

App crashes when opening user profile from split preview RHP offline then online

What is the root cause of that problem?

The report.parentReportID is changed from empty string to undefined after the API is complete, and then the app crashes here

const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`);

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

We should update like this

 const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID ? report.parentReportID : '-1'}`); 

const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`);

We should do the same for parentReportAction

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

App crashes when creating a new group and open a split bill details while offline then turn online.

What is the root cause of that problem?

The app crashes because the useOnyx key of the parentReport here changes from a collection key (report_) to a collection member key (report_undefined).

const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${props.route.params.reportID}`);
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`);

The parentReport relies on the report parentReportID. When we create a new group chat, we already passed undefined as the parentReportID.

App/src/libs/ReportUtils.ts

Lines 5359 to 5375 in b4b5965

return buildOptimisticChatReport(
participantAccountIDs,
reportName,
CONST.REPORT.CHAT_TYPE.GROUP,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
notificationPreference,
undefined,
undefined,
undefined,
avatarUri,
avatarFilename,
optimisticReportID,

But because it defaults to an empty string, an empty string of parentReportID is set.

parentReportID = '',

So, the onyx key will be report_. When the API is success, the parentReportID attribute is removed, so accessing it leads to undefined value (report_undefined).

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

We should change the default value to undefined instead of empty string.

parentReportID = '',

parentReportID = undefined,

We can optionally update/simplify this

const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`);

const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '-1'}`, {

const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID || '-1'}`);
const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID || '-1'}`, {

@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Oct 15, 2024
Copy link

melvin-bot bot commented Oct 15, 2024

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

@melvin-bot melvin-bot bot changed the title Split - App crashes when opening user profile from split preview RHP offline then online [$250] Split - App crashes when opening user profile from split preview RHP offline then online Oct 15, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 15, 2024
Copy link

melvin-bot bot commented Oct 15, 2024

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

@Anaslancer
Copy link
Contributor

Anaslancer commented Oct 17, 2024

Proposal

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

App crashes when opening user profile from split preview RHP offline then online

What is the root cause of that problem?

The app crashes because the useOnyx key of the parentReport and reportActions here changes from a collection key (report_, reportActions_) to a collection member key (report_undefined, reportActions_undefined).

const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '-1'}`);

const [parentReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '-1'}`, {

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

I changed the Ternary (Conditional) Operator for avoiding 'report_undefined' and 'reportActions_undefined' and it works fine.

What alternative solutions did you explore? (Optional)

We can't use '-1' for key. I tested with key as 'report_-1' and 'reportActions_-1' and app crashed.

Contributor details

Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01aff093c9a804b145

Copy link

melvin-bot bot commented Oct 17, 2024

📣 @Anaslancer! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

Copy link

melvin-bot bot commented Oct 18, 2024

@puneetlath, @alitoshmatov Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Oct 18, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Oct 22, 2024

@puneetlath, @alitoshmatov 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@alitoshmatov
Copy link
Contributor

@nkdengineer Thank you for your proposal, your RCA is correct and it solution solve the issue

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2024
@alitoshmatov
Copy link
Contributor

@bernhardoj Thank you for your proposal, your RCA is correct. Your solution also solve the issue, but since it is changing a buildOptimisticChatReport which is used a lot, I fear that it might cause some regression in the future.

@alitoshmatov
Copy link
Contributor

@Anaslancer Thank you for your proposal, your RCA is correct and your solution is similar to @nkdengineer 's

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Oct 23, 2024

I think we can with @nkdengineer 's solution. Since it was the first proposal

C+ reviewed 🎀 👀 🎀

@alitoshmatov
Copy link
Contributor

☝️ C+ reviewed 🎀 👀 🎀

Copy link

melvin-bot bot commented Oct 23, 2024

Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Oct 27, 2024
Copy link

melvin-bot bot commented Oct 27, 2024

📣 @alitoshmatov 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Oct 27, 2024

📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

Copy link

melvin-bot bot commented Oct 28, 2024

@puneetlath, @alitoshmatov, @nkdengineer Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Oct 29, 2024
@nkdengineer
Copy link
Contributor

@alitoshmatov The PR is ready.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 7, 2024
@melvin-bot melvin-bot bot changed the title [$250] Split - App crashes when opening user profile from split preview RHP offline then online [HOLD for payment 2024-11-14] [$250] Split - App crashes when opening user profile from split preview RHP offline then online Nov 7, 2024
Copy link

melvin-bot bot commented Nov 7, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 7, 2024
Copy link

melvin-bot bot commented Nov 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.58-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-11-14. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 7, 2024

@alitoshmatov @puneetlath The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@alitoshmatov
Copy link
Contributor

alitoshmatov commented Nov 10, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: https://github.com/Expensify/App/pull/49460/files#r1835764816

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: No need

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

No need

@alitoshmatov
Copy link
Contributor

We have switched to ND for payments, I requested payment via ND.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 14, 2024
@JmillsExpensify
Copy link

Waiting on payment summary

@puneetlath
Copy link
Contributor

Payment summary:

Thanks everyone!

@JmillsExpensify
Copy link

$250 approved for @alitoshmatov

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants