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] Task – App crashes when click on assignee in existing task #49514

Open
2 of 6 tasks
IuliiaHerets opened this issue Sep 20, 2024 · 22 comments
Open
2 of 6 tasks

[$250] Task – App crashes when click on assignee in existing task #49514

IuliiaHerets opened this issue Sep 20, 2024 · 22 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Sep 20, 2024

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: v9.0.39-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: https://expensify.testrail.io/index.php?/tests/view/4989792
Email or phone of affected tester (no customers): applausetester+jpcategory_2@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log in
  3. Open any chat
  4. Create a task without assignee
  5. Open task details and click on assignee

Expected Result:

Assignee list opens

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

2009.txt

Bug6609721_1726820372331.Assignee_crash.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021838194512143553982
  • Upwork Job ID: 1838194512143553982
  • Last Price Increase: 2024-09-23
  • Automatic offers:
    • jjcoffee | Reviewer | 104086587
    • nkdengineer | Contributor | 104086588
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Sep 20, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

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

melvin-bot bot commented Sep 20, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Sep 20, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Sep 20, 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.

@huult
Copy link
Contributor

huult commented Sep 20, 2024

Proposal

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

App crashes when click on assignee in existing task

What is the root cause of that problem?

Use 'report' before initialization

if (report && !ReportUtils.isTaskReport(report)) {

Screenshot 2024-09-20 at 16 00 15

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

Delay using the report until the report is complete.

// .src/pages/tasks/TaskAssigneeSelectorModal.tsx#L127
    const report: OnyxEntry<Report> = useMemo(() => {
        if (!route.params?.reportID) {
            return;
        }

+        InteractionManager.runAfterInteractions(() => {
+            requestAnimationFrame(() => {
                if (report && !ReportUtils.isTaskReport(report)) {
                    Navigation.isNavigationReady().then(() => {
                        Navigation.dismissModal(report.reportID);
                    });
                }
+            });
+        });

        return reports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.reportID}`];
    }, [reports, route]);
POC
Screen.Recording.2024-09-20.at.16.04.35.mp4

@nkdengineer
Copy link
Contributor

Proposal

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

App crashes

What is the root cause of that problem?

The report is used before it's initialize

const report: OnyxEntry<Report> = useMemo(() => {
if (!route.params?.reportID) {
return;
}
if (report && !ReportUtils.isTaskReport(report)) {
Navigation.isNavigationReady().then(() => {
Navigation.dismissModal(report.reportID);

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

Update this to get the report data from reports to check it's task report or not

const report: OnyxEntry<Report> = useMemo(() => {
    if (!route.params?.reportID) {
        return;
    }
    const reportOnyx = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.reportID}`];
    if (reportOnyx && !ReportUtils.isTaskReport(reportOnyx)) {
        Navigation.isNavigationReady().then(() => {
            Navigation.dismissModal(reportOnyx.reportID);
        });
    }
    return reports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.reportID}`];
}, [reports, route]);

What alternative solutions did you explore? (Optional)

Or we can move the navigate logic to another useEffect

const report: OnyxEntry<Report> = useMemo(() => {
    if (!route.params?.reportID) {
        return;
    }
    return reports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.reportID}`];
}, [reports, route]);

useEffect(() => {
    if (report && !ReportUtils.isTaskReport(report)) {
        Navigation.isNavigationReady().then(() => {
            Navigation.dismissModal(report.reportID);
        });
    }
}, [report]);

@flodnv
Copy link
Contributor

flodnv commented Sep 20, 2024

Why did this just start happening upon this deploy? What PR caused this?

@nkdengineer
Copy link
Contributor

@flodnv Maybe it is caused by #48325. I tried to revert to the latest commit in production and install node-module again and the bug didn't happen. The bug started happening when I reverted to the first different between production and staging and re-install node-module again.

Screenshot 2024-09-20 at 17 57 53 Screenshot 2024-09-20 at 17 58 13

@grgia
Copy link
Contributor

grgia commented Sep 20, 2024

@grgia
Copy link
Contributor

grgia commented Sep 20, 2024

Updated #49241 cc @luacmartins

@rayane-djouah
Copy link
Contributor

Updated #49241 cc @luacmartins

This is not the offending PR. I tried reverting it locally, and I'm still able to reproduce the bug.

@melvin-bot melvin-bot bot added the Overdue label Sep 23, 2024
@flodnv
Copy link
Contributor

flodnv commented Sep 23, 2024

@flodnv Maybe it is caused by #48325. I tried to revert to the latest commit in production and install node-module again and the bug didn't happen. The bug started happening when I reverted to the first different between production and staging and re-install node-module again.

Thanks @nkdengineer. @rojiphil @BrtqKr can you please check if #48325 caused this?

@melvin-bot melvin-bot bot removed the Overdue label Sep 23, 2024
@BrtqKr
Copy link
Contributor

BrtqKr commented Sep 23, 2024

@flodnv, I don't think this would be related. Seems like accessing report from task is making this work

    const report: OnyxEntry<Report> = useMemo(() => {
        if (!route.params?.reportID) {
            return;
        }
        if (task?.report && !ReportUtils.isTaskReport(task?.report)) {
            Navigation.isNavigationReady().then(() => {
                Navigation.dismissModal(task?.report?.reportID);
            });
        }
        return reports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.reportID}`];
    }, [reports, route]);

currently, the memo is accessing itself and it seems to be the reason, why this bug is occurring, but this is quite surprising because it's been working like this for a while somehow

    const report: OnyxEntry<Report> = useMemo(() => {
        if (!route.params?.reportID) {
            return;
        }
        if (report && !ReportUtils.isTaskReport(report)) {
            Navigation.isNavigationReady().then(() => {
                Navigation.dismissModal(report.reportID);
            });
        }
        return reports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.reportID}`];
    }, [reports, route]);

@flodnv
Copy link
Contributor

flodnv commented Sep 23, 2024

Right, it is strange. I assigned you @nkdengineer

@flodnv flodnv added the External Added to denote the issue can be worked on by a contributor label Sep 23, 2024
@melvin-bot melvin-bot bot changed the title Task – App crashes when click on assignee in existing task [$250] Task – App crashes when click on assignee in existing task Sep 23, 2024
Copy link

melvin-bot bot commented Sep 23, 2024

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

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

melvin-bot bot commented Sep 23, 2024

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

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

melvin-bot bot commented Sep 23, 2024

📣 @jjcoffee 🎉 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 Sep 23, 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 📖

@nkdengineer
Copy link
Contributor

Thanks, will raise the PR soon.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Hourly KSv2 labels Sep 23, 2024
@nkdengineer
Copy link
Contributor

@jjcoffee The PR is here

cc @flodnv

@flodnv
Copy link
Contributor

flodnv commented Sep 23, 2024

Thanks!

@alexpensify
Copy link
Contributor

Awesome, now we wait for this one to go to Prouduction.

@isagoico
Copy link

Retest was a pass 🎉

Recording.2024-09-23.115241.mp4

Checking it off the list.

@jasperhuangg jasperhuangg removed the DeployBlockerCash This issue or pull request should block deployment label Sep 30, 2024
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. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests