Skip to content

Spend - Category cell for expense in non-default workspace is empty after reset app #99448

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.60-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #99178
Email or phone of affected tester (no customers): sjdonisdjoisdjonjs@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Mac 26.5 / Chrome
App Component: Search

Action Performed:

Precondition:

  • Create two workspaces - A and B.
  • A is the default workspace.
  • Invite User B to workspace B.
  • User B creates an expense without category in workspace B.
  • Perform the steps below as User A:
  1. Go to staging.new.expensify.com
  2. Go to Account > Troubleshoot > Clear cache and restart > Reset and refresh.
  3. Go to Spend > Expenses. Do not go to Inbox at all.
  4. Click Category cell on the expense from User B.

Expected Result:

Category list will load.

Actual Result:

Category list is empty.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7242426_1787670346277.6.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7242426

Issue OwnerCurrent Issue Owner: @huult

Activity

  1. added
    Daily
    Bug
    on Aug 25, 2026
  2. applause-bot commented on Aug 25, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/4078cc882ae20a85d7c1bdd0016be89d183308ba6d0098be465ab389ba59d2de

  3. MelvinBot commented on Aug 25, 2026

    @MelvinBot
    Contributor

    Proposal

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

    The Category selector shows an empty list when a user opens the Category cell of an expense from Spend > Expenses (Search) for an expense in a non-default workspace (a workspace the user is a member of, but that is not their active policy), after a cache reset. Opening the same expense from the Inbox/report works.

    What is the root cause of that problem?

    The inline Search category picker reads policyCategories_<policyID> straight from Onyx but never fetches it. For a non-default member workspace on a fresh cache, that Onyx key is never populated (Search snapshots deliberately exclude policy categories), so the list resolves to {} → empty.

    The picker is read-only about this data:

    • CategoryPicker/index.tsx:64 reads POLICY_CATEGORIES + policyID from Onyx, and :75 falls back to {} when it's undefined.
    • The row itself confirms this data isn't in the snapshot — TransactionListItem/index.tsx:127: "Fetch policy categories directly from Onyx since they are not included in the search snapshot."
    • Nothing in the Search inline-edit path (CategoryCell → CategoryPickerModal → CategoryPicker) calls getPolicyCategories.

    By contrast, the RHP category step does fetch, which is why the Inbox/report path is fine: DynamicIOURequestStepCategory.tsx:149-165 runs fetchData() → getPolicyCategories(policyID) (API.read(GET_POLICY_CATEGORIES)) in a useEffect on policyID. The inline Search cell never routes through that component.

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

    Mirror the RHP fetch pattern in the inline Search path: when the Category picker opens (or the row mounts) and policyCategories_<policyID> is undefined, call getPolicyCategories(policyID). The lowest-risk spot is when CategoryPickerModal/CategoryCell opens, so we only fetch on demand.

    Suggested implementation sketch

    In CategoryCell.tsx (or CategoryPickerModal on open), add a useEffect that fires when the picker becomes visible:

    useEffect(() => {
        if (!isModalVisible || !policyID || policyCategories !== undefined) {
            return;
        }
        getPolicyCategories(policyID);
    }, [isModalVisible, policyID, policyCategories]);

    Reuse the existing guard from DynamicIOURequestStepCategory (skip when policyCategories is already present or offline), and add a loading state so the picker shows a spinner instead of "empty" while the read is in flight.

    The GetPolicyCategories READ command already exists and works — this is a frontend-only (Expensify/App) fix, no Auth/Web-Expensify change needed.

    What alternative solutions did you explore? (Optional)

    Eagerly fetching categories per visible row in TransactionListItem would also fix it but would fire one GetPolicyCategories read per distinct workspace on every Search load — heavier than fetching on demand when the picker opens.

    Investigation notes & related issues

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/99448) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  4. added
    External
    on Aug 25, 2026
  5. melvin-bot commented on Aug 25, 2026

    @melvin-bot

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

  6. melvin-bot commented on Aug 25, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  7. bernhardoj commented on Aug 26, 2026

    @bernhardoj
    Contributor

    I think dupe of #98838

  8. huult commented on Aug 27, 2026

    @huult
    Contributor

    Agree. This ticket is similar to #98838, so we should hold it until #98838 is resolved and then retest.

  9. melvin-bot commented on Sep 1, 2026

    @melvin-bot

    @huult Huh... This is 4 days overdue. Who can take care of this?

  10. huult commented on Sep 2, 2026

    @huult
    Contributor

    Same as above

  11. melvin-bot commented on Sep 7, 2026

    @melvin-bot

    @huult Huh... This is 4 days overdue. Who can take care of this?

  12. huult commented on Sep 8, 2026

    @huult
    Contributor

    Same as above

  13. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    @huult this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  14. huult commented on Sep 9, 2026

    @huult
    Contributor

    Same as above

  15. mountiny commented on Sep 9, 2026

    @mountiny
    Contributor

    Closing this in favour of #98838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions