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-09-21] [$1000] Assign task-Tapping on any contact, user unable to select assignee #25689

Closed
4 of 6 tasks
lanitochka17 opened this issue Aug 22, 2023 · 57 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

@lanitochka17
Copy link

lanitochka17 commented Aug 22, 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. Launch app
  2. Tap fab
  3. Tap assign task
  4. Enter title
  5. Tap next
  6. Select any user for Share somewhere
  7. Tap confirm task
  8. From the Confirmed Task screen
  9. Tap assignee
  10. Select any user - button unresponsive = you can't add an assignee

You can add an assignee by

Find a Task in the LHN > tap Assignee > you can assign one

Expected Result:

Tapping on any contact, user must be able to select assignee

Actual Result:

Tapping on any contact, user unable to select assignee

Workaround:

Unknown

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: 1.3.56-2

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6173366_cache.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01198bfad5e1717772
  • Upwork Job ID: 1694077716312887296
  • Last Price Increase: 2023-08-29
  • Automatic offers:
    • shubham1206agra | Contributor | 26488545
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 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

@akinwale
Copy link
Contributor

This looks like there is a long-running operation on the main thread which is blocking UI input for a few seconds before the tap to select a contact finally registers.

@Christinadobrzyn Christinadobrzyn changed the title Assign task-Tapping on any contact, user unable to select assignee [Android] Assign task-Tapping on any contact, user unable to select assignee Aug 22, 2023
@Christinadobrzyn Christinadobrzyn added the Needs Reproduction Reproducible steps needed label Aug 22, 2023
@Christinadobrzyn Christinadobrzyn changed the title [Android] Assign task-Tapping on any contact, user unable to select assignee Assign task-Tapping on any contact, user unable to select assignee Aug 22, 2023
@Christinadobrzyn Christinadobrzyn removed the Needs Reproduction Reproducible steps needed label Aug 22, 2023
@Christinadobrzyn
Copy link
Contributor

I can reproduce but this bug is inconsistent - but updated the OP to be as direct as possible on how to reproduce it. I think this can be External

@Christinadobrzyn Christinadobrzyn added the External Added to denote the issue can be worked on by a contributor label Aug 22, 2023
@melvin-bot melvin-bot bot changed the title Assign task-Tapping on any contact, user unable to select assignee [$1000] Assign task-Tapping on any contact, user unable to select assignee Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

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

melvin-bot bot commented Aug 22, 2023

Current assignee @Christinadobrzyn is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@saalimzafar
Copy link

saalimzafar commented Aug 22, 2023

Proposal

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

The problem at hand is the inability to select an assignee when tapping on any contact.

What is the root cause of that problem?

The root cause of this issue lies in the following code block:

// src/pages/tasks/TaskAssigneeSelectorModal.js
const [isLoading, setIsLoading] = React.useState(true);

const updateOptions = useCallback(() => {
    if (isLoading) {
        setIsLoading(false);
    }
  setIsLoading(true) // Update
}, [props, searchValue, isLoading]);

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

To resolve this issue, I propose the following changes:

// src/pages/tasks/TaskAssigneeSelectorModal.js
const [isLoading, setIsLoading] = useState(false);

const updateOptions = useCallback(() => {
    if (!isLoading) {
        setIsLoading(true);
    }
}, [props, searchValue, isLoading]);

What alternative solutions did you explore? (Optional)

N/A

@shubham1206agra
Copy link
Contributor

Unable to repro on DEV

@robertKozik
Copy link
Contributor

@shubham1206agra It's reproducible on the latest main. I'm also attaching a video for reference.

Screen.Recording.2023-08-23.at.13.42.04.mov

@saalimzafar I don't think your suggested root cause is correct, and the same applies to the solution you provided. The isLoading state controls whether the option list is visible or not, and it's set before any user interaction with the list. You can find it here:

shouldShowOptions={didScreenTransitionEnd && !isLoading}

Your proposed change would cause this screen to be stuck in the loading state, and only the skeleton of the components would be visible.

@shubham1206agra
Copy link
Contributor

@robertKozik I was able to repro this only once. Then after that I am unable to repro the result

@robertKozik
Copy link
Contributor

It appears that the issue is reproducible right after the task is created. If you navigate away from it and then return, it seems to work as intended.

@shubham1206agra
Copy link
Contributor

@robertKozik Yeah
This helps thanks

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Aug 23, 2023

Proposal

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

Assign task-Tapping on any contact, user unable to select assignee

What is the root cause of that problem?

This is due to race condition between unmounting NewTaskPage (which calls to clear the contents of Task inside Onyx) and setting the report inside task Onyx after the API call (or optimistic onyx set of the report and maybe response too).
This problem will occur when

useEffect(
() => () => {
if (!shouldClearOutTaskInfoOnUnmount.current) {
return;
}
Task.clearOutTaskInfo();
},
[],
);

will execute after

useEffect(() => {
Task.setTaskReport({...props.report});
}, [props.report]);

And props.report never changes after that in TaskView component.

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

Call Task.clearOutTaskInfo before the API call in Task.createTaskAndNavigate and remove the useEffect logic.

Edit - It looks like the unmounting logic was introduced due to #23342. So, we would introduce the state variable for the title and description in NewTaskPage to fix this problem, just like assignee and shareDestination inside here.

useEffect(() => {
setErrorMessage('');
// If we have an assignee, we want to set the assignee data
// If there's an issue with the assignee chosen, we want to notify the user
if (props.task.assignee) {
const displayDetails = Task.getAssignee(props.task.assigneeAccountID, props.personalDetails);
setAssignee(displayDetails);
}
// We only set the parentReportID if we are creating a task from a report
// this allows us to go ahead and set that report as the share destination
// and disable the share destination selector
if (props.task.parentReportID) {
Task.setShareDestinationValue(props.task.parentReportID);
}
// If we have a share destination, we want to set the parent report and
// the share destination data
if (props.task.shareDestination) {
setParentReport(lodashGet(props.reports, `report_${props.task.shareDestination}`, {}));
const displayDetails = Task.getShareDestination(props.task.shareDestination, props.reports, props.personalDetails);
setShareDestination(displayDetails);
}
}, [props]);

For example, not exact

if (!_.isUndefined(props.task.title)) {
    setTitle(props.task.title);
}

if (!_.isUndefined(props.task.description)) {
    setDescription(props.task.description);
}

And use state variable title and description instead of props.task.title, and props.task.description, respectively here.

<MenuItemWithTopDescription
description={props.translate('task.title')}
title={props.task.title || ''}
onPress={() => Navigation.navigate(ROUTES.NEW_TASK_TITLE)}
shouldShowRightIcon
/>
<MenuItemWithTopDescription
description={props.translate('task.description')}
title={props.task.description || ''}
onPress={() => Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)}
shouldShowRightIcon
numberOfLinesTitle={2}
titleStyle={styles.flex1}
/>

And it looks like something reverted the change from #23556.
Especially this change

- Task.editTaskAndNavigate(props.task.report, props.session.accountID, {
+ Task.editTaskAndNavigate(report, props.session.accountID, {

So, redoing this change might future-proof the problem.
Example

// Pass through the selected assignee
Task.editTaskAssigneeAndNavigate(report, props.session.accountID, option.login, option.accountID, assigneeChatReport);

What alternative solutions did you explore? (Optional)

Temporarily block the change in the task changes in Promise then mechanism when unmounting the NewTaskPage, and after unmounting, we can start resolving the changes (i.e. after calling of clearOutTaskInfo).

Examples of similar mechanisms can be found for Growl
https://github.com/Expensify/App/blob/43c6f11bd59b1d83ed4cef1162610f3e34aff701/src/libs/Growl.js

@robertKozik
Copy link
Contributor

robertKozik commented Aug 25, 2023

I cannot longer reproduce this issue on production environment, could you double-check on your end?

@shubham1206agra
Copy link
Contributor

I cannot longer reproduce this issue on production environment, could you double-check on your end?

@robertKozik
It's really hard to repro the issue from the start cause it's a race condition which has special case

@robertKozik
Copy link
Contributor

I got it, but beforehand (two days ago) I was able to reproduce it continuously. I'll try to repro it again and again

@shubham1206agra about your proposal - Root cause is propably correct (I'll confirm it as soon as I will be able to reproduce it). But using the simmilar machanism to Growl seems like an overkill there. Maybe we can try to extend the function Task.createTaskAndNavigate so it will synchronously invoke the Task.clearOutTaskInfo before executing navigation process? So we will no longer dependant only on component recycle method (returning the function from useEffect)

@shubham1206agra
Copy link
Contributor

I got it, but beforehand (two days ago) I was able to reproduce it continuously. I'll try to repro it again and again

@shubham1206agra about your proposal - Root cause is propably correct (I'll confirm it as soon as I will be able to reproduce it). But using the simmilar machanism to Growl seems like an overkill there. Maybe we can try to extend the function Task.createTaskAndNavigate so it will synchronously invoke the Task.clearOutTaskInfo before executing navigation process? So we will no longer dependant only on component recycle method (returning the function from useEffect)

Ok
This will be easier ig

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

melvin-bot bot commented Sep 4, 2023

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

@cristipaval
Copy link
Contributor

Thanks @robertKozik !
@shubham1206agra , you're all set! 🚀

@melvin-bot melvin-bot bot removed the Overdue label Sep 4, 2023
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 4, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 12, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @shubham1206agra got assigned: 2023-09-04 12:25:53 Z
  • when the PR got merged: 2023-09-12 21:39:27 UTC
  • days elapsed: 6

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 14, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Assign task-Tapping on any contact, user unable to select assignee [HOLD for payment 2023-09-21] [$1000] Assign task-Tapping on any contact, user unable to select assignee Sep 14, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Sep 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 14, 2023

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

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 Sep 14, 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:

  • [@robertKozik] The PR that introduced the bug has been identified. Link to the PR:
  • [@robertKozik] 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:
  • [@robertKozik] 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:
  • [@robertKozik] Determine if we should create a regression test for this bug.
  • [@robertKozik] 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.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@Christinadobrzyn
Copy link
Contributor

prepping for payment... @robertKozik should there be a regression test for this?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 21, 2023
@Christinadobrzyn
Copy link
Contributor

Also @cristipaval I see a merge freeze was involved in the PR merge, this might have affected the speed bonus. Do we think a speed bonus applies here?

@cristipaval
Copy link
Contributor

cristipaval commented Sep 24, 2023

Good point @Christinadobrzyn! Yes the speed bonus should apply, I checked the dates. I held the PR due to that merge freeze.

@robertKozik
Copy link
Contributor

CC. @Christinadobrzyn

@Christinadobrzyn
Copy link
Contributor

Payouts due:

Issue Reporter: NA
Contributor: $1000 +500 bonus @shubham1206agra in Upwork
Contributor+: @robertKozik payment through contract

Eligible for 50% #urgency bonus? Yes - #25689 (comment)

Upwork job is here.

@robertKozik let us know about the regression test so we can get this closed out -thanks!

@robertKozik
Copy link
Contributor

I don't think we need regression test for it #25689 (comment)

@Christinadobrzyn
Copy link
Contributor

Ah sorry I missed that note about the regression test. Thanks for clarifying! Closing this out.

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