Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.43k stars 2.8k forks source link

[$250] Assign Task - When changing Assignee, the page lags when closing modal #43410

Closed lanitochka17 closed 1 month ago

lanitochka17 commented 3 months ago

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: 1.4.81-4 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+emilio@applause.expensifail.com Issue reported by: Applause - Internal Team

Action Performed:

  1. Open New Expensify App
  2. Sign into a valid account (HT account is better for reproduction)
  3. Create a Task and then click on the IOU
  4. Change the Assignee and notice the page closing.

Expected Result:

User expects the page to close "clean"

Actual Result:

The page has a slight "lag/Delay" when closing, visible for a couple of seconds.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/2c655493-f95d-4e0a-99f7-be2a7c0d4bba

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01794355bb64abf4a9
  • Upwork Job ID: 1800741657347973622
  • Last Price Increase: 2024-07-10
  • Automatic offers:
    • allgandalf | Reviewer | 103151963
    • truph01 | Contributor | 103151965
Issue OwnerCurrent Issue Owner: @allgandalf
melvin-bot[bot] commented 3 months ago

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

lanitochka17 commented 3 months ago

@JmillsExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

JmillsExpensify commented 3 months ago

I'll open it up to the community for proposals.

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

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

truph01 commented 3 months ago

Proposal

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

The page has a slight "lag/Delay" when closing, visible for a couple of seconds.

What is the root cause of that problem?

After selecting the assignee in https://github.com/Expensify/App/blob/8d11d0b185083a6a813daeb0fe7c0697a5627ef6/src/pages/tasks/TaskAssigneeSelectorModal.tsx#L182, some Onyx updates will occur that affect the JS thread. Those Onyx updates are from TaskActions.editTaskAssignee that was called here, they updates both the report and report actions which are heavy.

Right after that we goBack, so the navigation animation is affected by the Onyx updates.

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

Make use of useWaitForNavigation, we can navigate first, then handle the Onyx data update in the background, the Onyx data update is not user-visible so it's best done in the background so other user-visible things like navigation/animation is not obstructed

Navigation.dismissModal(report.reportID);

waitForNavigate(() => {
    // handle the data update here
});

The data update is this block

And do the same in the new task case

What alternative solutions did you explore? (Optional)

Run the navigation in InteractionManager.runAfterInteractions so it waits for the Onyx updates to complete before navigating

InteractionManager.runAfterInteractions(() => {
    Navigation.dismissModal(report.reportID);
});

And in here too

Another optional point to consider, in https://github.com/Expensify/App/blob/8d11d0b185083a6a813daeb0fe7c0697a5627ef6/src/pages/tasks/TaskAssigneeSelectorModal.tsx#L240, it's connecting to the full reports collection even though only 1 report from the route param is needed. We can change to connect to only that 1 report by withOnyx or useOnyx, it will also help it to be more smooth.

Some other notes:

truph01 commented 3 months ago

Proposal has been updated to add an optional change

truph01 commented 3 months ago

Proposal updated to add alternative fix

allgandalf commented 3 months ago

@truph01 , Your current RCA is:

some Onyx updates will occur that affect the JS thread. Right after that we goBack, so the navigation animation is affected by the Onyx updates.

Can you please point as to what Onyx updates you are referring to? it's necessary to have a clear RCA for us to proceed with solution,

We should know why first then we can think of possible solution to a bug , thanks and looking forward to your reply

truph01 commented 3 months ago

Can you please point as to what Onyx updates you are referring to?

@allgandalf Appreciate the feedback! I added more details to the proposal.

allgandalf commented 3 months ago

Chill melvin, will review the updated proposal today/tomorrow πŸ‘

melvin-bot[bot] commented 3 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

allgandalf commented 3 months ago

@JmillsExpensify Discussing something internally

allgandalf commented 3 months ago

Internal discussion on this issue was completed, will review the pending proposal tomorrow πŸ‘

melvin-bot[bot] commented 3 months ago

@JmillsExpensify @allgandalf this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

allgandalf commented 3 months ago

sorry was AFK, will review today/tomorrow, reviewing an urgent deploy blocker today

allgandalf commented 3 months ago

@truph01 , your RCA is correct, and according to the expected result:

User expects the page to close "clean"

I think your solution is good to go!

@truph01 's Main Soution looks good to me here

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

@roryabraham , please find the initial summary here

melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @roryabraham, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 3 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] commented 3 months ago

@JmillsExpensify, @roryabraham, @allgandalf Whoops! This issue is 2 days overdue. Let's get this updated quick!

allgandalf commented 3 months ago

friendly bump @roryabraham for assignment

melvin-bot[bot] commented 3 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

allgandalf commented 3 months ago

bump to @roryabraham for assignment

melvin-bot[bot] commented 2 months ago

@JmillsExpensify @roryabraham @allgandalf this issue is now 4 weeks old, please consider:

Thanks!

melvin-bot[bot] commented 2 months ago

@JmillsExpensify, @roryabraham, @allgandalf Huh... This is 4 days overdue. Who can take care of this?

allgandalf commented 2 months ago

@roryabraham , the assignment summary is here, can you please assign when you find time :) thanks

melvin-bot[bot] commented 2 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

allgandalf commented 2 months ago

With all respect πŸ™‡

πŸŽ€πŸ‘€πŸŽ€

melvin-bot[bot] commented 2 months ago

Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

allgandalf commented 2 months ago

@MonilBhavsar , you can find the summary here

MonilBhavsar commented 2 months ago

Proposal looks good!

it's connecting to the full reports collection even though only 1 report from the route param is needed. We can change to connect to only that 1 report by withOnyx or useOnyx, it will also help it to be more smooth.

Did we check the impact of this change. How much is it helping? And do you mean to use selector?

truph01 commented 2 months ago

Did we check the impact of this change. How much is it helping?

@MonilBhavsar I checked and it doesn't help much with regards to the lagging issue in the OP, I thought it's nice to have.

And do you mean to use selector?

I tested using both and similar result, I lean towards using useOnyx (if we include that change) as it's the new standard.

The main solution in What changes do you think we should make in order to solve the problem? is the part that makes it look smooth and the lagging is gone.

melvin-bot[bot] commented 2 months ago

@JmillsExpensify, @MonilBhavsar, @allgandalf Eep! 4 days overdue now. Issues have feelings too...

JmillsExpensify commented 2 months ago

Working through the proposal. @MonilBhavsar thoughts on that last response?

allgandalf commented 2 months ago

waiting for assignment melvin...

MonilBhavsar commented 2 months ago

Okay, thanks for clarifying. Let's move ahead and we can update to use useOnyx

melvin-bot[bot] commented 2 months ago

πŸ“£ @allgandalf πŸŽ‰ 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

melvin-bot[bot] commented 2 months ago

πŸ“£ @truph01 πŸŽ‰ 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 πŸ“–

truph01 commented 2 months ago

PR https://github.com/Expensify/App/pull/45691 can be reviewed

allgandalf commented 2 months ago

Left some comments over the PR @truph01 , thanks

mvtglobally commented 2 months ago

Issue not reproducible during KI retests. (First week)

allgandalf commented 2 months ago

Woah, @truph01 can you verify on staging if this is still reproducible ?

allgandalf commented 2 months ago

friendly bump @truph01

truph01 commented 2 months ago

@allgandalf I tested it on my end, and the bug is still reproducible, but not consistently.

allgandalf commented 2 months ago

how should we proceed here @MonilBhavsar ?, Qa said the bug is not reproducible and contributor says it is reproducible but not consistently

truph01 commented 2 months ago

@allgandalf What about your end? Can you reproduce it?

allgandalf commented 2 months ago

bump @MonilBhavsar

MonilBhavsar commented 2 months ago

Sorry missed it somehow. i think we should still fix it and improve the code. I guess it will be constantly reproduced on high traffic accounts?

allgandalf commented 2 months ago

I guess it will be constantly reproduced on high traffic accounts?

Let me check on current staging

allgandalf commented 2 months ago

The issue is reproducible to me on staging, i will go forward with reviewing the PR

https://github.com/user-attachments/assets/d1fe1775-a348-4349-a8e0-9eee923c1b7d