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

[$500] Expense - Preview shows 0 requests briefly when visiting workspace chat for the first time #33949

Closed
6 tasks done
kbecciv opened this issue Jan 4, 2024 · 32 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff

Comments

@kbecciv
Copy link

kbecciv commented Jan 4, 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: v1.4.21-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:
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:

Precondition: There are a few manual requests and ongoing scanning requests in the workspace chat.

  1. Send a message in another chat (for web and desktop app)
  2. Log out.
  3. Log in.
  4. Go to the workspace chat.

Expected Result:

The expense preview will show the number of requests.

Actual Result:

The expense preview shows 0 requests briefly, while there is no issue with the number of scanning requests.

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

Bug6332084_1704370716093.20240104_085815.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01eca5a466b3de3517
  • Upwork Job ID: 1742890349435052032
  • Last Price Increase: 2024-01-27
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 4, 2024
@melvin-bot melvin-bot bot changed the title Expense - Preview shows 0 requests briefly when visiting workspace chat for the first time [$500] Expense - Preview shows 0 requests briefly when visiting workspace chat for the first time Jan 4, 2024
Copy link

melvin-bot bot commented Jan 4, 2024

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

Copy link

melvin-bot bot commented Jan 4, 2024

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

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

melvin-bot bot commented Jan 4, 2024

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

Copy link

melvin-bot bot commented Jan 4, 2024

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

@paultsimura
Copy link
Contributor

paultsimura commented Jan 4, 2024

Proposal

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

On the first render of the ReportPreview action, the total requests count is set to 0.

What is the root cause of that problem?

We are calculating the total number of requests using reportPreviewAction.childMoneyRequestCount, which is not loaded on the first render of the report preview, and defaults to 0:

/**
* Returns the number of money requests associated with a report preview
*/
function getNumberOfMoneyRequests(reportPreviewAction: OnyxEntry<ReportAction>): number {
return reportPreviewAction?.childMoneyRequestCount ?? 0;
}

This value is updated in Onyx only after the successful OpenReport API response:
image

And the numberOfScanningReceipts uses count of transactions instead of the reportAction data:

const transactionsWithReceipts = ReportUtils.getTransactionsWithReceipts(props.iouReportID);
const numberOfScanningReceipts = _.filter(transactionsWithReceipts, (transaction) => TransactionUtils.isReceiptBeingScanned(transaction)).length;

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

We can use TransactionUtils.getAllReportTransactions calculation as a fallback if the value from ReportActionsUtils.getNumberOfMoneyRequests is 0, since the TransactionUtils.getAllReportTransactions is using the same approach as numberOfScanningReceipts – counting transactions:

const numberOfRequests = ReportActionUtils.getNumberOfMoneyRequests(props.action) || _.size(TransactionUtils.getAllReportTransactions(props.iouReportID));

const numberOfRequests = ReportActionUtils.getNumberOfMoneyRequests(props.action);

What alternative solutions did you explore? (Optional)

@rojiphil
Copy link
Contributor

rojiphil commented Jan 4, 2024

Proposal

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

Expense - Preview shows 0 requests briefly when visiting workspace chat for the first time. We are trying to avoid showing this briefly.

What is the root cause of that problem?

Briefly showing of 0 preview count is due to the fact that openReport takes time to update the childMoneyRequestCount of Report Preview Action.

As per the discussion here cc @mountiny , to tackle performance problems, BE would want to send just enough data and FE would be used to display just that with little modifications.

And I am not sure if relying on transactions count would be a good idea here as that would bring about external dependency even when the required childMoneyRequestCount is available within the Report Preview action. If for performance reason, BE does not send the transactions at some later point, we will again have the issue.

To me, it looks like showing the preview subtitle even when childMoneyRequestCount is 0 is the cause of the problem as shown here

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

We can prevent showing the preview subtitle if childMoneyRequestCount is 0 by replacing the condition here like this:

         {!isScanning && numberOfRequests > 0 && (numberOfRequests > 1 || hasReceipts) && (

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jan 9, 2024

Will be working on review today.

@melvin-bot melvin-bot bot removed the Overdue label Jan 9, 2024
@abdulrahuman5196
Copy link
Contributor

The root cause mentioned by the contributors is correct, we don't have the childMoneyRequestCount and many other child information data. It is only got when OpenReport is successful.
@sakluger Could you kindly check internally if this is intentional? If not most likely the fix is goes to be internal.

Copy link

melvin-bot bot commented Jan 11, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 16, 2024

@sakluger, @abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...

@sakluger
Copy link
Contributor

sakluger commented Jan 16, 2024

Checking internally on this now: https://expensify.slack.com/archives/C05DWUDHVK7/p1705435853915939

@sakluger
Copy link
Contributor

We do want to fix this! I've added to Wave 5 - Release 5, and I am changing the priority to weekly since it's polish, which is lower priority.

@sakluger sakluger added Weekly KSv2 and removed External Added to denote the issue can be worked on by a contributor Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Jan 17, 2024
@abdulrahuman5196
Copy link
Contributor

@sakluger Could you kindly provide update if you have any?
#33949 (comment)

I don't have access to the mentioned slack chat?

@melvin-bot melvin-bot bot added the Overdue label Jan 24, 2024
@sakluger
Copy link
Contributor

We may need to hold one more day to find out if this is BE or can be done in the FE, sorry for the wait.

@melvin-bot melvin-bot bot removed the Overdue label Jan 25, 2024
@sakluger sakluger added the Hot Pick Ready for an engineer to pick up and run with label Jan 26, 2024
@sakluger
Copy link
Contributor

I threw the hot pick label so we can find an internal engineer to help.

@sakluger sakluger added 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 and removed Internal Requires API changes or must be handled by Expensify staff labels Jan 26, 2024
Copy link

melvin-bot bot commented Jan 26, 2024

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

@sakluger sakluger removed the Hot Pick Ready for an engineer to pick up and run with label Jan 26, 2024
@sakluger
Copy link
Contributor

I heard back from our engineers - We'd like this solved in the front end. Thanks for checking!

@neil-marcellini neil-marcellini self-assigned this Jan 26, 2024
Copy link

melvin-bot bot commented Jan 27, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@abdulrahuman5196
Copy link
Contributor

Thank you for the confirmation. Will check on frontend fixes.

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@abdulrahuman5196
Copy link
Contributor

Will be working on proposal review today.

@abdulrahuman5196
Copy link
Contributor

@sakluger I don't see this issue anymore. Could you kindly check on this?

Screen.Recording.2024-01-31.at.8.24.47.PM.mov

Copy link

melvin-bot bot commented Feb 1, 2024

@sakluger @neil-marcellini @abdulrahuman5196 this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is today
  • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added Internal Requires API changes or must be handled by Expensify staff and removed 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 labels Feb 1, 2024
Copy link

melvin-bot bot commented Feb 1, 2024

Current assignee @abdulrahuman5196 is eligible for the Internal assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added the Overdue label Feb 2, 2024
@abdulrahuman5196
Copy link
Contributor

@sakluger To check on this #33949 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Feb 5, 2024
@neil-marcellini
Copy link
Contributor

I'm also not able to reproduce the bug, so I'm going to close this.

0totalBug.mov

@github-project-automation github-project-automation bot moved this from Release 5: Best in Class to Done in [#whatsnext] Wave 05 - Deprecate Free Feb 5, 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. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff
Projects
No open projects
Development

No branches or pull requests

6 participants