App: [SMARTSCAN] [$500] MEDIUM: Update the workspace chat report preview component when a receipt scan completes

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:

Prerequisite: Use the example receipt provided below, because it will likely hit an image parser and complete super fast to test this.

  1. Create a workspace on staging.new.expensify.com
  2. Invite a member to it
  3. As the member, sign-in and navigate to your workspace chat on the workspace
  4. Upload a receipt
  5. Observe the “Receipt scan in progress…” report preview component
  6. Give it 15-30s or so to finish scanning
  7. Navigate away from the workspace chat (i.e tap < to the LHN or click the report preview component)
  8. Navigate back to the workspace chat

Expected Result:

The report preview component should update with the receipt data automatically without needing to navigate away and back to the chat

Actual Result:

The report preview component does not update

Workaround:

Yes, as described above to navigate away and back.

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: v1.3.64-0 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 Notes/Photos/Videos:

mWeb safari reproduction: https://github.com/Expensify/App/assets/16232057/019912f4-8c89-415f-92c6-8f1f363a033e

iOS native app reproduction: https://github.com/Expensify/App/assets/16232057/2fa42280-be97-49d9-a62a-5de4699bf94c

Mac Chrome reproduction: https://github.com/Expensify/App/assets/16232057/13172aa7-0abe-435e-aa24-8e25e9225077

Example receipt to use: SaaStr Sept4th Test Receipt

Expensify/Expensify Issue URL: Issue reported by: @trjExpensify Slack conversation: Internal

View all open jobs on GitHub

CC: @Gonals @MariaHCD @JmillsExpensify @dylanexpensify

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01eae90794b2b26fd4
  • Upwork Job ID: 1699178450385817600
  • Last Price Increase: 2023-10-02
Issue OwnerCurrent Issue Owner: @MariaHCD

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 100 (68 by maintainers)

Most upvoted comments

I think I managed to find all root cause and solution.

BUG1: (frontend) report preview is not re-rendered when transaction pusher event is received so keep scanning

Screenshot 2023-11-15

After fixing BUG1, “keep scanning” issue is gone. But amount shows 0 instead of correct value fetched from receipt. This is because of BUG2 and BUG3 below:

BUG2: (backend) report action pusher event is not received so message[0].text is still old value. i.e. xxx owes $0.00 which expects xxx owes $20.00

https://github.com/Expensify/App/blob/3bbb2142cd3744cc5942ef6494d096c7a2b42ffe/src/components/ReportActionItem/ReportPreview.js#L160-L169

BUG3: (backend) iouReport pusher event is not received so total is still old value as 0.

Fixing BUG2 still doesn’t fix the issue completely. It’s just fallback when iouReport doesn’t exist or iouReport.total = 0 according to this line: https://github.com/Expensify/App/blob/3bbb2142cd3744cc5942ef6494d096c7a2b42ffe/src/components/ReportActionItem/ReportPreview.js#L150-L152

Either fixing BUG2 or BUG3 will fix wrong amount issue but BUG3 is more priority than BUG2 because iouReport has important data of whether to show or hide settlement button:

https://github.com/Expensify/App/blob/3bbb2142cd3744cc5942ef6494d096c7a2b42ffe/src/components/ReportActionItem/ReportPreview.js#L188-L190

Especially this condition: reimbursableSpend !== 0

cc: @MariaHCD

Thanks, @MariaHCD. Looks like Ioni has responded with a coupla’ Qs!

@s-alves10 fixing bug 2 or bug 3 will fix bug 1 because ReportPreview is re-rendered. If transaction pusher event is received separately, this should be issue but I don’t think backend will do that. All events will come together when scan complete. So all good.

Ah, I think we can add Reviewing Internal and remove Help Wanted right, Maria?