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.34k stars 2.77k forks source link

[$250] Submit - $0.00 report is shown when moving expense to a new report #48994

Open IuliiaHerets opened 6 days ago

IuliiaHerets commented 6 days 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: v9.0.32-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): gibethlehem@gmail.com Issue reported by: Applause Internal Team

Action Performed:

Precondition: Create a workspace add an employee

As an employee

  1. Go to OD and create a report on the workspace (make sure to open the ND workspace chat as well.)
  2. Add a expense on the report
  3. Delete the expense(Not the report)
  4. Create a new report on the OD and add two expense
  5. Move one of the expense to a new report
  6. Go to ND and notice that the moved expense is shown as $0.00. Note: Switching chats, refreshing and also going to the report brings the correct amount)

Expected Result:

Moved expense show the correct amount of money.

Actual Result:

Moved expense shows $0.00 on ND. The correct amount comes only after navigating to the report

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/99f3b352-0bd4-40e9-8182-0e32724d8001

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021833945245991752277
  • Upwork Job ID: 1833945245991752277
  • Last Price Increase: 2024-09-11
Issue OwnerCurrent Issue Owner: @s77rt
melvin-bot[bot] commented 6 days ago

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

IuliiaHerets commented 6 days ago

@greg-schroeder 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

melvin-bot[bot] commented 5 days ago

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

melvin-bot[bot] commented 5 days ago

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

jestinjoshi commented 4 days ago

I've investigated the issue, and it appears that the problem lies not with the frontend but with the API call for GetMissingOnyxMessages. This API is not returning the updated total for the report, which is why the frontend isn't reflecting the changes.

However, when a user switches to a different chat and then returns to the original chat, the OpenReport API is triggered, and it successfully retrieves the updated total for the report, allowing the user to see the correct information.

@s77rt @greg-schroeder

AttockOffice85 commented 4 days ago

hi @jestinjoshi and other folks

I’ve tried reproducing the issue following the description and video, but it’s a bit unclear and takes some time to follow. In my case, everything seems to work fine. Could someone please provide clearer steps or confirm if they can reproduce the issue?

s77rt commented 4 days ago

@jestinjoshi Were you able to reproduce the bug? In my case I didn't get the moved expense showing up at all, I had to switch chats and got it correctly

https://github.com/user-attachments/assets/1330b8f9-92bc-4f79-99ce-674a2cd7e83c

cc @AttockOffice85 above video may help

Michael-Obele commented 4 days ago

Hey folks, just as @jestinjoshi mentioned, I also believe it's from the API call, and I think adding a useMemo would fix the problem.

melvin-bot[bot] commented 4 days ago

📣 @Michael-Obele! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
Michael-Obele commented 4 days ago

Contributor details Your Expensify account email: amachree9630@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~010aff84665e3ea1e9

melvin-bot[bot] commented 4 days ago

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

jestinjoshi commented 4 days ago

I was able to reproduce the issue, but not following the steps outlined by OP.

To reproduce the issue:

  1. Ensure that the report is visible in the ND workspace chat.
  2. Go to OD and update the report by adding additional expenses.
  3. While the report is displayed on the ND, add an emoji reaction to the report. This action will trigger the GetMissingOnyxMessages API call to refresh the report. Note that sometimes the API gets triggered automatically by Pusher, but I haven't been able to figure out the exact conditions for this behavior.
  4. After the API call, note that the number of expenses in the report updates correctly, but the total amount does not reflect the new value.

The total is calculated from iouReport which is not being updated with the latest total value.

To fix this issue, GetMissingOnyxMessages API should return iouReport.total (report_{reportKey}) in its response.

@AttockOffice85 @s77rt @Michael-Obele

s77rt commented 4 days ago

@Michael-Obele Can you please elaborate how this is a backend issue and were you able to reproduce the bug?

s77rt commented 4 days ago

@jestinjoshi That's a different bug. I still get the expense itself showing the correct amount

Michael-Obele commented 4 days ago

@Michael-Obele Can you please elaborate how this is a backend issue and were you able to reproduce the bug?

Although I have not quite figured it out, I believe the issue is more with how the component retrieves the balance after the money is moved to a different category. For this reason, I proposed using a useMemo to include the balance so it is recomputed after the money is moved to a different category.

jestinjoshi commented 4 days ago

That's a different bug. I still get the expense itself showing the correct amount

@s77rt OP is highlighting an issue where the correct total amount is not being updated, as described in their Expected Result section. If you watch the end of the video shared by OP, you'll notice that when they move the expenses to a new report, the number of expenses is updated, but the total amount in the report does not reflect the correct value.

Although I followed a different set of steps to reproduce the issue, the core problem remains the same.

jestinjoshi commented 4 days ago

@s77rt I was able to reproduce the issue and have created a video with audio explaining the problem. As mentioned earlier, the issue is still related to the GetMissingOnyxMessages API. I hope the video helps clarify the problem.

https://github.com/user-attachments/assets/881f507b-9a0b-48bf-a86d-3ed437af19f3

s77rt commented 3 days ago

I'm having trouble reproducing this bug because I can't see the policy expense chat (asked in slack) but I agree this is something to fix in the backend.

Edit: I'm able to reproduce now

https://github.com/user-attachments/assets/7555ae83-6585-43a2-8c81-9ccf92f3a908

🎀 👀 🎀 Internal

melvin-bot[bot] commented 3 days ago

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

melvin-bot[bot] commented 21 hours ago

@madmax330, @s77rt, @greg-schroeder Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

greg-schroeder commented 15 hours ago

@madmax330 can you confirm this should be an Internal issue based on the above discussion? I'm not super sure on the BE requirements here