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] IOU - IOU preview loading skeleton displays in room chat when user requested money and relogin #33766

Closed
6 tasks done
kbecciv opened this issue Dec 29, 2023 · 44 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Dec 29, 2023

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: 1.4.19.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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open app
  2. Create a Workspace
  3. Add a few members
  4. Open announce room of the workspace
  5. Make a split bill with all members
  6. Sign Out
  7. Sign In with the same account
  8. Navigate to announce room

Expected Result:

IOU preview should be displayed with amount

Actual Result:

IOU preview loading skeleton displays in room chat when user requested money and relogin

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

Bug6328556_1703870235441.Rpreplay_Final1703869667.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019428618ac31844be
  • Upwork Job ID: 1740790325272899584
  • Last Price Increase: 2024-01-05
  • Automatic offers:
    • paultsimura | Contributor | 28090718
@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 Dec 29, 2023
@melvin-bot melvin-bot bot changed the title IOU - IOU preview loading skeleton displays in room chat when user requested money and relogin [$500] IOU - IOU preview loading skeleton displays in room chat when user requested money and relogin Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 2023

Job added to Upwork: https://www.upwork.com/jobs/~019428618ac31844be

Copy link

melvin-bot bot commented Dec 29, 2023

Triggered auto assignment to @sonialiap (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 Dec 29, 2023
Copy link

melvin-bot bot commented Dec 29, 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

Copy link

melvin-bot bot commented Dec 29, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jan 1, 2024
@paultsimura
Copy link
Contributor

paultsimura commented Jan 1, 2024

Proposal

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

The report preview is not properly loaded after relogin.

What is the root cause of that problem?

It's a result of the memory load-reducing changes that were introduced recently: we don't load the IOU report data from the BE when opening a chat report: #32658 (comment)

Therefore, the transaction data is not present in Onyx until we open the IOU report itself.

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

According to #32658 (comment), we should use the data stored in a report action itself to display the IOU report preview. Therefore, we should use the data from props.action (mostly from the props.action.originalMessage to build the data on MoneyRequestPreview if the props.transaction is missing (we can make it a separate function ReportActionsUtils.getOriginalTransactionDetails:

{
    amount: lodashGet(props.action, 'originalMessage.amount', 0),
    currency: lodashGet(props.action, 'originalMessage.currency', ''),
    comment: lodashGet(props.action, 'originalMessage.comment', ''),
    merchant: lodashGet(props.action, 'originalMessage.merchant', ''),
}

This will make sure we show most of the data while the transaction is not loaded explicitly:

image

We might also want to coordinate with BE to add extra details to the action.originalMessage, like the merchant (currently it's present only in the transaction).

What alternative solutions did you explore? (Optional)

Copy link

melvin-bot bot commented Jan 1, 2024

@sonialiap, @allroundexperts Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@DylanDylann
Copy link
Contributor

Proposal

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

IOU preview loading skeleton displays in room chat when user requested money and relogin

What is the root cause of that problem?

After logout and login again, the OpenReport API doesn't return transaction data and the IOU report. So the App display loading skeleton because this logic

{_.isEmpty(props.transaction) &&
!ReportActionsUtils.isMessageDeleted(props.action) &&
lodashGet(props.action, 'pendingAction') !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? (
<MoneyRequestSkeletonView />
) : (
<View style={styles.moneyRequestPreviewBoxText}>

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

{_.isEmpty(props.transaction) &&
!ReportActionsUtils.isMessageDeleted(props.action) &&
lodashGet(props.action, 'pendingAction') !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE ? (
<MoneyRequestSkeletonView />
) : (
<View style={styles.moneyRequestPreviewBoxText}>

I suggest we should remove this logic

And then in here

const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = ReportUtils.getTransactionDetails(props.transaction);

we should update logic to use information from action when transaction is empty like this

const {amount: requestAmount, currency: requestCurrency, comment: requestComment, merchant: requestMerchant} = 
            !_.isEmpty(props.transaction) ? ReportUtils.getTransactionDetails(props.transaction) :  {
                amount: lodashGet(props.action, 'originalMessage.amount', 0),
                currency: lodashGet(props.action, 'originalMessage.currency', ''),
                comment: lodashGet(props.action, 'originalMessage.comment', ''),
                merchant: lodashGet(props.action, 'originalMessage.merchant', '')
            };

We also can create a utils function to return transaction details from reportActions

What alternative solutions did you explore? (Optional)

NA

@sonialiap
Copy link
Contributor

@allroundexperts what do you think of the above proposals?

@melvin-bot melvin-bot bot removed the Overdue label Jan 4, 2024
Copy link

melvin-bot bot commented Jan 4, 2024

@sonialiap, @allroundexperts Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Jan 5, 2024

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

@allroundexperts
Copy link
Contributor

@paultsimura's proposal looks good enough to me. It's simple and handles the problem correctly. I think we might need to store merchant in the original message as well but that can be done independently on the backend.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 7, 2024

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

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

melvin-bot bot commented Jan 9, 2024

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

@youssef-lr
Copy link
Contributor

youssef-lr commented Jan 11, 2024

We decided to fix this one in the backend, it was by design in the past, but we can now remove a check that was preventing split transactions from being returned in chat rooms.

Copy link

melvin-bot bot commented Feb 2, 2024

@youssef-lr, @paultsimura, @sonialiap, @Gonals, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

@youssef-lr
Copy link
Contributor

Still in the works, I've switched focus to https://github.com/Expensify/Expensify/issues/339870 which is a high priority issue, getting back to this next week.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 2, 2024
Copy link

melvin-bot bot commented Feb 6, 2024

@youssef-lr, @paultsimura, @sonialiap, @Gonals, @allroundexperts Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@youssef-lr
Copy link
Contributor

Still on my radar this week.

@melvin-bot melvin-bot bot removed the Overdue label Feb 6, 2024
@youssef-lr
Copy link
Contributor

Working on finalizing the PR now.

@melvin-bot melvin-bot bot added the Overdue label Feb 12, 2024
Copy link

melvin-bot bot commented Feb 13, 2024

@youssef-lr, @paultsimura, @sonialiap, @Gonals, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

@youssef-lr
Copy link
Contributor

I pushed some new changes as I discovered a bug in the process, but I still have a failing test that I need to work on. I'm resuming work on it tomorrow.

@melvin-bot melvin-bot bot removed the Overdue label Feb 14, 2024
@youssef-lr
Copy link
Contributor

No update yet, but I'm sure I'll be able to fix the test by Monday. I wasn't able to fully focus on this Pr as I'm working on higher priority stuff.

@melvin-bot melvin-bot bot added the Overdue label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

@youssef-lr, @paultsimura, @sonialiap, @Gonals, @allroundexperts Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@sonialiap
Copy link
Contributor

@youssef-lr any updates on the testing?

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2024
@youssef-lr
Copy link
Contributor

@sonialiap I'm still planning to finish the PR today.

@melvin-bot melvin-bot bot added the Overdue label Feb 21, 2024
@youssef-lr
Copy link
Contributor

I could not get to finishing this, I switched focus to a high priority issue, I'm done with it today and can resume this one.

@melvin-bot melvin-bot bot removed the Overdue label Feb 22, 2024
@youssef-lr
Copy link
Contributor

Test is fixed and I've just made the PR ready for review.

@youssef-lr youssef-lr added the Reviewing Has a PR in review label Feb 22, 2024
@youssef-lr
Copy link
Contributor

We have a test failing in every Auth PR, we're looking to get it fixed here.

@youssef-lr
Copy link
Contributor

We're good to go here.

@paultsimura
Copy link
Contributor

paultsimura commented Feb 29, 2024

@sonialiap @youssef-lr according to our guidelines, since I was hired for this task and even made a PR, shouldn't I and @allroundexperts be paid for this task even if it was eventually moved to internal?

Similar case: #23826 (comment)

@youssef-lr
Copy link
Contributor

youssef-lr commented Feb 29, 2024

In my opinion, I don't think your proposal should have been selected by @allroundexperts , it doesn't support displaying some fields that are not present in the report action, nor does it support displaying changes made to a transaction. I think even if we had moved forward with your PR, we would have most likely ended up reverting it down the line and implemented the backend fix instead.

@allroundexperts
Copy link
Contributor

@youssef-lr Here's what I think:

it doesn't support displaying some fields that are not present in the report action

It's clearly mentioned in the proposal that we'll need backend support in order to implement the missing fields.

nor does it support displaying changes made to a transaction

That was not the intention of this bug as far as I've understood. The proposal clearly stated to just use the action as a fallback in case when the transaction was not available. This is clearly stated in the selected proposal:

Therefore, we should use the data from props.action (mostly from the props.action.originalMessage to build the data on MoneyRequestPreview if the props.transaction is missing

@youssef-lr
Copy link
Contributor

It's clearly mentioned in the proposal that we'll need backend support in order to implement the missing fields.

This means also running a query to support old actions in the database that don't have those fields..so a bit more work. We actually used to display all fields from the report actions and then we moved to displaying them from the transaction, so the proposal is suggesting we take a step backwards.

The proposal clearly stated to just use the action as a fallback in case when the transaction was not available.

@allroundexperts I get you, but I disagree that this is a valid solution, the transaction should always be present, if it isn't, then there's something wrong and we can't apply a bandaid instead of fixing it from the root.

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 Engineering Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

7 participants