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-03-07] [$125] Web - Thread - Console error shows up when opening message in thread #37253

Closed
1 of 6 tasks
lanitochka17 opened this issue Feb 27, 2024 · 31 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Feb 27, 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: 1.4.44-0
Reproducible in staging?: Y
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: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat
  3. Send a message
  4. Right click on the message > Reply in thread

Expected Result:

No console error will show up

Actual Result:

Console error shows up when opening message in thread

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

Add any screenshot/video evidence

Bug6393509_1708999870296.bandicam_2024-02-27_06-35-39-042.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fd70450a1c9c7c93
  • Upwork Job ID: 1762304222689734656
  • Last Price Increase: 2024-02-27
  • Automatic offers:
    • dukenv0307 | Contributor | 0
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment External Added to denote the issue can be worked on by a contributor labels Feb 27, 2024
@melvin-bot melvin-bot bot changed the title Web - Thread - Console error shows up when opening message in thread [$500] Web - Thread - Console error shows up when opening message in thread Feb 27, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 27, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Feb 27, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 27, 2024
Copy link
Contributor

👋 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 Feb 27, 2024

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

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp
CC @quinthar

@askavyblr
Copy link

askavyblr commented Feb 27, 2024

Proposal

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

Console error shows up when Reply in the thread

What is the root cause of that problem?

scrollRef.current?.getScrollableNode().childNodes[0] is undefined.

const getContentView = React.useCallback(() => scrollRef.current?.getScrollableNode().childNodes[0], []);

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

getScrollableNode() method returns undefined, meaning that there is no scrollable node available at the time this function is called.

Ensure that getScrollableNode() returns a valid element before trying to access its childNodes property.

const getContentView = React.useCallback(() => scrollRef.current?.getScrollableNode().childNodes[0], []);

Change To

const getContentView = React.useCallback(() => {
    const scrollableNode = scrollRef.current?.getScrollableNode();
    if (scrollableNode) {
        return scrollableNode.childNodes[0];
    }
    return null; // or handle the case when the scrollable node is not available
}, [scrollRef]);

What alternative solutions did you explore? (Optional)

@sobitneupane
Copy link
Contributor

sobitneupane commented Feb 27, 2024

Thanks for the proposal @askavyblr.

I think we can simply do the following change to solve the issue.

-    const getContentView = React.useCallback(() => scrollRef.current?.getScrollableNode().childNodes[0], []);
+    const getContentView = React.useCallback(() => scrollRef.current?.getScrollableNode()?.childNodes[0], []);

cc: @techievivek

@youssef-lr youssef-lr changed the title [$500] Web - Thread - Console error shows up when opening message in thread [$125] Web - Thread - Console error shows up when opening message in thread Feb 27, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

Upwork job price has been updated to $125

@techievivek
Copy link
Contributor

@sobitneupane Changes looks good to me, will you push the PR for this?

@techievivek
Copy link
Contributor

I can review and merge.

@askavyblr
Copy link

askavyblr commented Feb 27, 2024

@techievivek can i raise the PR

@sobitneupane
Copy link
Contributor

Changes looks good to me, will you push the PR for this?

Sure @techievivek.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Feb 27, 2024

@sobitneupane I think the following fix better addresses the root cause and avoiding running expensive effects, please consider that as well

Proposal

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

Console error shows up when opening message in thread

What is the root cause of that problem?

In here, we're triggering prepareForMaintainVisibleContentPosition on first render (by using useEffect) without making sure that the flatlist was actually mounted on the screen, this leads to the getScrollableNode here returning undefined (because the flatlist was not rendered yet), causing the console error.

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

We should make sure the flatlist was already rendered first before running the effect here, when the list was already rendered, getScrollableNode will always be defined and there's no need for optional chaining that are less readable.

Define a ref here

const isListRenderedRef = React.useRef(false);

In here:

onLayout={(e) => {
    isListRenderedRef.current = true;
    props.onLayout?.(e);
}}

In here

if (!isListRenderedRef.current) {
    return;
}

What alternative solutions did you explore? (Optional)

NA

@askavyblr
Copy link

@techievivek I will give you the solution first, please assign it to me

@sobitneupane
Copy link
Contributor

@techievivek

@dukenv0307's proposal deals with the root cause of the issue. I think we can go with his proposal.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 27, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Hourly KSv2 labels Feb 27, 2024
@dukenv0307
Copy link
Contributor

@sobitneupane PR #37261 is ready to review

@techievivek techievivek removed the DeployBlockerCash This issue or pull request should block deployment label Feb 27, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 29, 2024
@melvin-bot melvin-bot bot changed the title [$125] Web - Thread - Console error shows up when opening message in thread [HOLD for payment 2024-03-07] [$125] Web - Thread - Console error shows up when opening message in thread Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 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 Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.45-6 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-03-07. 🎊

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 7, 2024
Copy link

melvin-bot bot commented Mar 7, 2024

Issue is ready for payment but no BZ is assigned. @MitchExpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

@MitchExpensify
Copy link
Contributor

Payment summary:

C+: $125 @sobitneupane (NewDot)
C: $125 @dukenv0307 (Upwork)

I couldn't find any older contract for you @dukenv0307 so I created this job, let me know when you've accepted the offer and I'll issue payment 🙇 https://www.upwork.com/jobs/~016662aefe6aa80518

@melvin-bot melvin-bot bot added the Overdue label Mar 11, 2024
@techievivek
Copy link
Contributor

Not overdue, we are issuing the payments. CC @MitchExpensify

@melvin-bot melvin-bot bot removed the Overdue label Mar 12, 2024
@dukenv0307
Copy link
Contributor

@youssef-lr @techievivek Hi I see after this comment, you've downgraded the issue bounty to $125, I assume that's because the change suggested is tiny, just adding the ? to avoid undefined object access.

However that "quick change" is a workaround. The root cause and solution of this issue is actually different and more complex (see here), and that's what we went with to fix the issue (with urgency as it was a deploy blocker).

Could we honor the original bounty ($500) for the issue since it was not dead simple as initially suggested?

@MitchExpensify
Copy link
Contributor

Waiting on @dukenv0307 to accept the offer in order to pay 🙇

@youssef-lr
Copy link
Contributor

@dukenv0307 I think I lowered the bounty due to this being just a console error and it's not really affecting the user. Do you think the console error is a smoke for an actual bug in the UI that is noticeable by the user?

@melvin-bot melvin-bot bot added the Overdue label Mar 15, 2024
@MitchExpensify
Copy link
Contributor

Bump on accepting this offer as a next step @dukenv0307 https://www.upwork.com/nx/wm/offer/101299289

@melvin-bot melvin-bot bot removed the Overdue label Mar 17, 2024
@dukenv0307
Copy link
Contributor

@dukenv0307 I think I lowered the bounty due to this being just a console error and it's not really affecting the user

Thanks for the explanation.

Bump on accepting this offer as a next step @dukenv0307 https://www.upwork.com/nx/wm/offer/101299289

@MitchExpensify I accepted, thank you!

@MitchExpensify
Copy link
Contributor

Paid and contract ended 🙇

@sobitneupane
Copy link
Contributor

Requested payment in newDot.

Payment Summary: #37253 (comment)

@JmillsExpensify
Copy link

$125 approved for @sobitneupane based on summary.

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 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