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 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] Chat - App crash when reply in thread image #29446

Closed
2 of 6 tasks
kbecciv opened this issue Oct 12, 2023 · 31 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

@kbecciv
Copy link

kbecciv commented Oct 12, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: Dev 1.3.83.1
Reproducible in staging?: n
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697117854435399

Action Performed:

  1. Open any chat
  2. Send an image
  3. Hover on image and click reply in thread

Expected Result:

App does not crash

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2023-10-12.at.20.38.04.mov
MacOS: Desktop
Screen.Recording.2023-10-12.at.20.47.58.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015aaed14521ed9d68
  • Upwork Job ID: 1712468082854531072
  • Last Price Increase: 2023-10-12
  • Automatic offers:
    • mollfpr | Reviewer | 27162314
    • namhihi237 | Reporter | 27162317
    • s77rt | Contributor | 27162338
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 12, 2023
@melvin-bot melvin-bot bot changed the title Dev: Chat - App crash when reply in thread image [$500] Dev: Chat - App crash when reply in thread image Oct 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 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

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

melvin-bot bot commented Oct 12, 2023

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

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 12, 2023

I think this is a regression from this PR #29134.

@hungvu193
Copy link
Contributor

Proposal

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

App crash when clicking reply in thread.

What is the root cause of that problem?

It's a regression from:
#29134

We're using getClientRects get the collections DomRect object, however while transitioning getClientRects will return empty array and make chooseBoundingBox return undefined which caused the crashed.

function chooseBoundingBox(target, clientX, clientY) {
const slop = 5;
const bbs = target.getClientRects();

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

Updated chooseBoundingBox return bounds as a backup value when target.getClientRects(); return empty arrays.

What alternative solutions did you explore? (Optional)

N/A

@situchan
Copy link
Contributor

cc: @teneeto @s77rt

@ikevin127
Copy link
Contributor

The issue is a regression from PR: #29134

Proposal

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

App should not crash when reply in thread is clicked on an attachment.

What is the root cause of that problem?

The issue seems to be caused by the chooseBoundingBox function which might not always return a value i.e., it returns undefined when the condition within the for loop is not met. This results in betterBounds being undefined inside updateBounds function, leading to the crash.

for (let i = 0; i < bbs.length; i++) {
const bb = bbs[i];
if (clientXMin <= bb.right && clientXMax >= bb.left && clientYMin <= bb.bottom && clientYMax >= bb.top) {
return bb;
}
}
// If no matching bounding box is found, fall back to the first one.
// This could only happen if the user is moving the mouse very quickly
// and they got it outside our slop above.
return bbs[0];
}

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

Adding a condition to check if betterBounds of updateBounds function is indeed not undefined before performing operations on it:

    const updateBounds = (bounds) => {
        if (bounds.width === 0) {
            setIsRendered(false);
        }
        // Choose a bounding box for the tooltip to target.
        // In the case when the target is a link that has wrapped onto
        // multiple lines, we want to show the tooltip over the part
        // of the link that the user is hovering over.
        const betterBounds = chooseBoundingBox(target.current, initialMousePosition.current.x, initialMousePosition.current.y);
+       if (betterBounds) {
            setWrapperWidth(betterBounds.width);
            setWrapperHeight(betterBounds.height);
            setXOffset(betterBounds.x);
            setYOffset(betterBounds.y);
+       }
    };

What alternative solutions did you explore? (Optional)

Ensuring that chooseBoundingBox always returns a value, even a default one like so:

function chooseBoundingBox(target, clientX, clientY) {
    const slop = 5;
    const bbs = target.getClientRects();
    const clientXMin = clientX - slop;
    const clientXMax = clientX + slop;
    const clientYMin = clientY - slop;
    const clientYMax = clientY + slop;

    for (let i = 0; i < bbs.length; i++) {
        const bb = bbs[i];
        if (clientXMin <= bb.right && clientXMax >= bb.left && clientYMin <= bb.bottom && clientYMax >= bb.top) {
            return bb;
        }
    }

    // If no matching bounding box is found, fall back to the first one.
    // This could only happen if the user is moving the mouse very quickly
    // and they got it outside our slop above.
+   // or fallback to 0 values if no bounding box is found
-   return bbs[0];
+   return bbs[0] || { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 };
}

Videos:

MacOS: Chrome / Safari
web.mov

@teneeto
Copy link
Contributor

teneeto commented Oct 12, 2023

Hi, I’m Eto Olei from Callstack and I would like to work in this issue, because I am the author of the #29134

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

📣 @mollfpr 🎉 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

@mountiny
Copy link
Contributor

@teneeto will handle this as an author of the PR

@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

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

Offer link
Upwork job

@mountiny mountiny changed the title [$500] Dev: Chat - App crash when reply in thread image Dev: Chat - App crash when reply in thread image Oct 12, 2023
@s77rt
Copy link
Contributor

s77rt commented Oct 12, 2023

@mountiny Assign me as well

@mountiny mountiny assigned s77rt and unassigned mollfpr Oct 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 12, 2023

📣 @s77rt 🎉 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 📖

@mountiny
Copy link
Contributor

How do you see these so fast 🤯

@kbecciv
Copy link
Author

kbecciv commented Oct 12, 2023

App crashes when clicking on currency

Action Performed:

  1. Open a chat 

  2. Go to the send money 
/ request money
  3. Click on currency

Expected Result: App should not crash when clicking on currency
Actual Result: App crashes when clicking on currency

2023-10-12.19-57-56.mp4

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Oct 12, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] Chat - App crash when reply in thread image [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] Chat - App crash when reply in thread image Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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 2023-10-23. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt] 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:
  • [@s77rt] A discussion in #expensify-bugs 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:
  • [@s77rt] Determine if we should create a regression test for this bug.
  • [@s77rt] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@CortneyOfstad] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@s77rt
Copy link
Contributor

s77rt commented Oct 17, 2023

@CortneyOfstad
Copy link
Contributor

CortneyOfstad commented Oct 18, 2023

I am going to be OoO when this needs to be paid, so reassigning the BZ label 👍

Payment Summary

  • @namhihi237 to be paid $50 in Upwork as Bug Reporter
  • @s77rt to be paid $500 in Upwork (pending any regressions) as Contributor
  • @teneeto does not require payment in Upwork as C+

@CortneyOfstad CortneyOfstad added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Oct 18, 2023
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 18, 2023
@CortneyOfstad CortneyOfstad removed their assignment Oct 18, 2023
@Expensify Expensify deleted a comment from melvin-bot bot Oct 18, 2023
@Expensify Expensify deleted a comment from melvin-bot bot Oct 18, 2023
@CortneyOfstad CortneyOfstad added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Oct 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@CortneyOfstad CortneyOfstad self-assigned this Oct 18, 2023
@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Oct 19, 2023
@Expensify Expensify deleted a comment from melvin-bot bot Oct 20, 2023
@laurenreidexpensify laurenreidexpensify added Weekly KSv2 Daily KSv2 and removed Daily KSv2 Weekly KSv2 labels Oct 20, 2023
@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@laurenreidexpensify
Copy link
Contributor

Payment Summary

  • @namhihi237 - paid $50 in Upwork as Bug Reporter
  • @teneeto does not require payment in Upwork - expert contributor
  • @s77rt to be paid $500 in Upwork - please apply to job

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@s77rt
Copy link
Contributor

s77rt commented Oct 23, 2023

@laurenreidexpensify This is a regression. We only need to pay the bug reporter here. This can be 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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests