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-08-15] App crashes when edited description of task #23210

Closed
1 of 6 tasks
kavimuru opened this issue Jul 19, 2023 · 38 comments
Closed
1 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 Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kavimuru
Copy link

kavimuru commented Jul 19, 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!


Action Performed:

  1. Open a chat
  2. Go to the "Assign task" section
  3. Enter a title and create task
  4. 
Click on description and edit it

Expected Result:

App should not crash when editing description of task

Actual Result:

App crashes when edited description of task

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: dev
Reproducible in staging?: n/a
Reproducible in production?: n/a
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
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-07-19.at.7.22.31.PM.mov

Expensify/Expensify Issue URL:
Issue reported by: @ayazhussain79
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1689776819661849

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010d8887850db77d1d
  • Upwork Job ID: 1691486821752541184
  • Last Price Increase: 2023-08-15
@kavimuru kavimuru added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 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

@OSBotify
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.

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

Triggered auto assignment to @yuwenmemon (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@thienlnam
Copy link
Contributor

I can't seem to reproduce this on dev

@thienlnam
Copy link
Contributor

@yuwenmemon Can you confirm before we close this out?

@aldo-expensify
Copy link
Contributor

I can try to reproduce

@aldo-expensify
Copy link
Contributor

ah, this happens in IOS, I may not be able to reproduce reliably. I'll try in Android, but it is not good enough to discard the deploy blocker I think.

@aldo-expensify
Copy link
Contributor

I confirmed that it crashes in Android native too, I don't know if this crashes on production

@aldo-expensify
Copy link
Contributor

I'm failing to reproduce in dev. One thing I noticed before the crash was that the description showed up empty before editing and crashing, and I had typed something when I created the task.

@ahmdshrif
Copy link
Contributor

Proposal

Please restate the problem that we are trying to solve in this issue.

The App crashes when the user changes the task description.

What is the root cause of that problem?

This issue is a regression from this [PR](#22983).

The root cause is that when we create a new task, we leave the CreateTaskPage and then we clear the report task from ONYX, as shown here:

Task.clearOutTaskInfo();

Then, when a TaskViewer opens, we set the task that comes from its parent to the task:

Task.setTaskReport({...props.report, isExistingTaskReport: true});

This order was the assumption, but the current behavior is that TaskViewer mounts before CreateTaskPage unmounts. So, first the TaskViewer sets its report to the ONYX report viewer, and then CreateTaskPage unmounts and removes the current task viewer. This makes the task undefined which leads to this crash.

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

Simply, we can revert this PR, because this is a more important issue.

The problem there is before this pr the task viewer gets removed early before the CreateTaskPage becomes invisible, and that makes the task title an empty string in the time of leaving the screen.
I think the solution for that is to use the local state "currentTask" in the component and the currentTask state will get updated from ONYX task if it matches the previous state id like this:

    const [currentTask, setCurrentTask] = React.useState({});
   
    useEffect(() => {
        if (!currentTask.parentReportID && props.task.parentReportID) {
            setCurrentTask(props.task);
        } else if (props.task.parentReportID === currentTask.parentReportID) {
            setCurrentTask(props.task);
        }
    }, [props.task]);

then we can use it instead of props. task wich will be clear before the component unmount.

What alternative solutions did you explore? (Optional)

Maybe use a timeout to set the report viewer.
Or create a separate state on ONYX for new tasks, separate from task viewer state.

cc : @aldo-expensify @thienlnam

@0xmiros
Copy link
Contributor

0xmiros commented Jul 20, 2023

@dukenv0307 please check this one. I think this came from #22983, though I am not able to reproduce,

@ayazhussain79
Copy link
Contributor

@thienlnam @aldo-expensify Still able to reproduce it after taking new pull from main branch

Screen.Recording.2023-07-20.at.12.21.51.PM.mov

@dukenv0307
Copy link
Contributor

@0xmiroslav We have 2 ways to move forward

  1. Revert the previous PR that cause this regression and create another PR to fix the previous bug again
  2. Create a new PR to fix this bug with my below solution if you agree with it

Proposal

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

App crashes when edited description of task

What is the root cause of that problem?

In the previous PR, we decide to call clearOutTaskInfo when NewTaskPage unmounts. We also have logic to set the task field in here

function TaskView(props) {
useEffect(() => {
Task.setTaskReport({...props.report, isExistingTaskReport: true});
}, [props.report]);

Unfortunately, setTaskReport is executed before clearOutTaskInfo, so the task field is empty

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

We expect that clearOutTaskInfo is executed before setTaskReport. So I think we should call setTaskReport after interaction by using InteractionManager.runAfterInteractions like this

InteractionManager.runAfterInteractions(() => {
            console.log("setTaskReport")
            Task.setTaskReport({...props.report, isExistingTaskReport: true});
        });

Results

Screen-Recording-2023-07-20-at-15.07.50.mp4

@0xmiros
Copy link
Contributor

0xmiros commented Jul 20, 2023

I think it's better to revert. That solution seems not ideal

@dukenv0307
Copy link
Contributor

@0xmiroslav #23243 this is reverted PR, Please help to check

@yuwenmemon yuwenmemon added the Reviewing Has a PR in review label Jul 20, 2023
@yuwenmemon
Copy link
Contributor

Revert has been merged just need to CP it to Staging

@situchan
Copy link
Contributor

Same bug happens on Assignee modal - #23342 (comment).

@situchan
Copy link
Contributor

@ayazhussain79 can you please confirm in staging/production that native app still crashes following repro step in #23210 (comment)?

@ayazhussain79
Copy link
Contributor

ayazhussain79 commented Jul 25, 2023

@situchan yes not able to select assignee console warning displayed

Screenshot 2023-07-25 at 1 28 48 PM

@situchan
Copy link
Contributor

yeah, it's another bug. Even crashes when update description

@ayazhussain79
Copy link
Contributor

here is another bug when pressing back button on assignee page its returns back to the task creating page

Screen.Recording.2023-07-25.at.1.46.22.PM.mov

@situchan
Copy link
Contributor

Even crashes when update description

This is fixed in latest main (#23342 merged). Still happens on staging / production

@ayazhussain79
Copy link
Contributor

@thienlnam @aldo-expensify @mallenexpensify this bug is just pending for payment

@mountiny mountiny added Daily KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review Weekly KSv2 labels Aug 15, 2023
@mountiny mountiny added External Added to denote the issue can be worked on by a contributor and removed Overdue labels Aug 15, 2023
@melvin-bot melvin-bot bot changed the title DEV: App crashes when edited description of task [$1000] DEV: App crashes when edited description of task Aug 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

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

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

melvin-bot bot commented Aug 15, 2023

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

@mountiny mountiny changed the title [$1000] DEV: App crashes when edited description of task [HOLD for payment 2023-08-15] App crashes when edited description of task Aug 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

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

@mountiny
Copy link
Contributor

Matt is probably ooo, this is ready to paid to the reporter as the bug is fixed.

@laurenreidexpensify
Copy link
Contributor

@mountiny sorry just to be clear, are you saying the only payment required on this issue is to the bug reporter?

@mountiny
Copy link
Contributor

Correct, I think this PR has solved this issue too but the root casue was the same so we should not be paying for this issue to the contributor PR author #23342

So just $250 to @ayazhussain79

@laurenreidexpensify
Copy link
Contributor

offer sent to @ayazhussain79 in Upwork!

@ayazhussain79
Copy link
Contributor

@laurenreidexpensify offer accepted, Thank you

@laurenreidexpensify
Copy link
Contributor

Payment 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 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 Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests