App icon indicating copy to clipboard operation
App copied to clipboard

Track expense- Category list loads infinitely when categorizing expense from invited workspace

Open IuliiaHerets opened this issue 1 year ago • 11 comments

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: 9.0.64-4 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. [User A] Invite User B to workspace.
  3. [User B] Do not open workspace chat invited by User A.
  4. [User B] Go to self DM.
  5. [User B] Track a manual expense.
  6. [User B] Select Categorize it from the actionable whisper.
  7. [User B] Click on the invited workspace.

Expected Result:

Category list will load without issue.

Actual Result:

Category list loads infinitely when categorizing expense from invited workspace and the invited workspace chat has not been opened yet.

Workaround:

Unknown

Platforms:

  • [x] Android: Standalone
  • [x] Android: HybridApp
  • [x] Android: mWeb Chrome
  • [x] iOS: Standalone
  • [x] iOS: HybridApp
  • [x] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/18eb49b0-fe39-4192-8bad-259b8e0fabe4

View all open jobs on GitHub

IuliiaHerets avatar Nov 20 '24 17:11 IuliiaHerets

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

melvin-bot[bot] avatar Nov 20 '24 17:11 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-11-21 13:54:21 UTC.

Proposal

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

Category list loads infinitely when categorizing expense from invited workspace

What is the root cause of that problem?

This is a backend issue. We are unable to get policy categories.

  • Screenshot 2024-11-21 at 16 06 31

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

To resolve this issue, we must update the backend or if we don't want to update it, we can use 'openReport' instead of fetching policy categories because categories are included in the response of openReport, and we can use them directly. Something like this:

https://github.com/Expensify/App/blob/4a7f23f1d84568464228392f737317b58a10dde4/src/pages/iou/request/step/IOURequestStepCategory.tsx#L87-L93

// src/pages/iou/request/step/IOURequestStepCategory.tsx#L87

    const fetchData = () => {
        if (policy && policyCategories) {
            return;
        }
+        if (report?.reportID) {
+            Report.openReport(report?.reportID, report?.reportActionID);
+        }
        Category.getPolicyCategories(report?.policyID ?? '-1');
    };
POC

https://github.com/user-attachments/assets/e4457f1b-8c78-474a-9f50-e82fa196f17e

What alternative solutions did you explore? (Optional)

we can create a new useEffect to watch for when we call Category.getPolicyCategories(report?.policyID ?? '-1'). If policyCategories returns undefined, we must call Report.openReport(report?.reportID, report?.reportActionID);.

// src/pages/iou/request/step/IOURequestStepCategory.tsx#L86
    useEffect(() => {
        if (isLoadingOnyxValue(policyCategoriesRealResult) || isLoadingOnyxValue(policyCategoriesDraftResult)) {
            return;
        }

        if (!policyCategories && report?.reportID) {
            Report.openReport(report?.reportID, report?.reportActionID);
        }
    }, [policyCategories, policyCategoriesDraftResult, policyCategoriesRealResult, report?.reportActionID, report?.reportID]);

huult avatar Nov 21 '24 09:11 huult

Triaged

johncschuster avatar Nov 25 '24 21:11 johncschuster

@johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 29 '24 09:11 melvin-bot[bot]

Waiting on proposals for this one

johncschuster avatar Dec 02 '24 22:12 johncschuster

we have one proposal to review

huult avatar Dec 02 '24 23:12 huult

@johncschuster this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 04 '24 09:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 06 '24 09:12 melvin-bot[bot]

I couldn't action this today. I will check it out this weekend.

johncschuster avatar Dec 06 '24 23:12 johncschuster

I'll work to find someone that can tackle this internally

johncschuster avatar Dec 09 '24 17:12 johncschuster

@IuliiaHerets can I get a retest on this to see if it persists?

johncschuster avatar Dec 10 '24 22:12 johncschuster

@johncschuster Tester can't repro this issue in the latest build

https://github.com/user-attachments/assets/4201a6b6-f175-4fd6-8a86-df930e0435f6

IuliiaHerets avatar Dec 12 '24 07:12 IuliiaHerets

Great! In that case, let's close this up!

johncschuster avatar Dec 13 '24 22:12 johncschuster