Skip to content

[Due for payment 2026-02-25] Company Cards - Error is not shown when navigated to Company Cards page #81115

Closed

Description

@jponikarchuk

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: 9.3.11-17
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #80734
Email or phone of affected tester (no customers): applausetester+omqq1@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Web (Mac/Chrome)
App Component: Workspace Settings

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Navigate to Troubleshoot page
  3. Enable "Simulate failing network requests"
  4. Clear onyx data
  5. Navigate to Workspaces tab
  6. Create a workspace
  7. Navigate to Company Cards

Expected Result:

The new error UI should be shown

Actual Result:

The standard landing page is shown instead of the error page.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @brianlee-expensify

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 31, 2026
  2. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 31, 2026
  3. melvin-bot commented on Jan 31, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jan 31, 2026

    @melvin-bot

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

  5. MobileMage commented on Jan 31, 2026

    @MobileMage
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-01-31 19:38:10 UTC.

    Proposal

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

    When navigating to the Company Cards page of a newly created workspace while "Simulate failing network requests" is enabled and Onyx data has been cleared, the expected error UI (introduced in PR #80734) does not appear. Instead, the standard landing/empty state page is shown, even though the backend request to load company card feeds has failed.

    What is the root cause of that problem?

    When a workspace is created optimistically with failing network requests, the policy object never receives a workspaceAccountID from the server because the CreateWorkspace API call fails. The optimistic policy data does not include workspaceAccountID, so it remains undefined.

    value: {
    id: policyID,
    type: workspaceType,
    name: workspaceName,
    role: CONST.POLICY.ROLE.ADMIN,
    owner: currentUserEmailParam,
    ownerAccountID: currentUserAccountIDParam,
    isPolicyExpenseChatEnabled: true,
    outputCurrency,
    pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    autoReporting: true,
    approver: currentUserEmailParam,
    autoReportingFrequency: shouldEnableWorkflowsByDefault ? CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE : CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT,
    approvalMode:
    shouldEnableWorkflowsByDefault && engagementChoice !== CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE ? CONST.POLICY.APPROVAL_MODE.BASIC : CONST.POLICY.APPROVAL_MODE.OPTIONAL,
    harvesting: {
    enabled: !shouldEnableWorkflowsByDefault,
    },
    created: DateUtils.getDBTime(),
    customUnits,
    areCategoriesEnabled: true,
    areCompanyCardsEnabled: true,
    areTagsEnabled: false,
    areDistanceRatesEnabled,
    areWorkflowsEnabled: shouldEnableWorkflowsByDefault,
    areReportFieldsEnabled: false,
    areConnectionsEnabled: false,
    areExpensifyCardsEnabled: false,
    employeeList: {
    [currentUserEmailParam]: {
    submitsTo: currentUserEmailParam,
    email: currentUserEmailParam,
    role: CONST.POLICY.ROLE.ADMIN,
    errors: {},
    },
    ...(adminParticipant?.login
    ? {
    [adminParticipant.login]: {
    submitsTo: currentUserEmailParam,
    email: adminParticipant.login,
    role: CONST.POLICY.ROLE.ADMIN,
    errors: {},
    },
    }
    : {}),
    },
    chatReportIDAdmins: makeMeAdmin ? adminsChatReportID.toString() : undefined,
    pendingFields: {
    autoReporting: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    approvalMode: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    reimbursementChoice: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    name: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    outputCurrency: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    address: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    description: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    type: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    areReportFieldsEnabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    customRules: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
    },
    defaultBillable: false,
    defaultReimbursable: true,
    disabledFields: {defaultBillable: true, reimbursable: false},
    avatarURL: file?.uri,
    originalFileName: file?.name,
    ...optimisticMccGroupData.optimisticData,
    requiresCategory: true,
    fieldList: {
    [CONST.POLICY.FIELDS.FIELD_LIST_TITLE]: {
    defaultValue: CONST.POLICY.DEFAULT_REPORT_NAME_PATTERN,
    pendingFields: {defaultValue: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, deletable: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD},
    type: CONST.POLICY.DEFAULT_FIELD_LIST_TYPE,
    target: CONST.POLICY.DEFAULT_FIELD_LIST_TARGET,
    name: CONST.POLICY.DEFAULT_FIELD_LIST_NAME,
    fieldID: CONST.POLICY.FIELDS.FIELD_LIST_TITLE,
    deletable: true,
    },
    },
    },

    As a result, on the Company Cards page, workspaceAccountID falls back to CONST.DEFAULT_NUMBER_ID (which is 0), and domainOrWorkspaceAccountID also resolves to 0.

    const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID;
    const companyCards = useCompanyCards({policyID});
    const {
    allCardFeeds,
    feedName,
    selectedFeed,
    bankName,
    isFeedPending,
    isFeedAdded,
    onyxMetadata: {cardListMetadata},
    } = companyCards;
    const domainOrWorkspaceAccountID = getDomainOrWorkspaceAccountID(workspaceAccountID, selectedFeed);

    The openPolicyCompanyCardsPage function is then called with domainOrWorkspaceAccountID = 0, and both its optimistic and failure data are written to the Onyx collection key sharedNVP_private_domain_member_0.

    function openPolicyCompanyCardsPage(policyID: string, domainOrWorkspaceAccountID: number, translate: LocaleContextProps['translate']) {
    const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`,
    value: {
    isLoading: true,
    errors: null,
    },
    },
    ];
    const successData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`,
    value: {
    isLoading: false,
    },
    },
    ];
    const failureData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER>> = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainOrWorkspaceAccountID}`,
    value: {
    isLoading: false,
    errors: {
    [CONST.COMPANY_CARDS.WORKSPACE_FEEDS_LOAD_ERROR]: translate('workspace.companyCards.error.workspaceFeedsCouldNotBeLoadedMessage'),
    },
    },
    },
    ];
    const params: OpenPolicyExpensifyCardsPageParams = {
    policyID,
    };
    API.read(READ_COMMANDS.OPEN_POLICY_COMPANY_CARDS_PAGE, params, {optimisticData, successData, failureData});

    However, Onyx is configured with skippableCollectionMemberIDs that includes the string '0' (derived from DEFAULT_NUMBER_ID). This causes Onyx to silently discard any writes to collection keys whose member ID suffix is '0'.

    SKIPPABLE_COLLECTION_MEMBER_IDS: [String(DEFAULT_NUMBER_ID), '-1', 'undefined', 'null', 'NaN'] as string[],

    skippableCollectionMemberIDs: CONST.SKIPPABLE_COLLECTION_MEMBER_IDS,

    Because the failure data (containing the error) is silently dropped by Onyx, the workspaceCardFeedsErrors in the Table component remains undefined, feedErrorKey is never set, and the error UI at line 377 never renders. Instead, the isNoFeed condition at line 356 is true (since no feed data was loaded) and the empty state is shown.

    const areWorkspaceCardFeedsLoading = !!workspaceCardFeedsStatus?.[domainOrWorkspaceAccountID]?.isLoading;
    const workspaceCardFeedsErrors = workspaceCardFeedsStatus?.[domainOrWorkspaceAccountID]?.errors;
    const selectedFeedStatus = selectedFeed?.status;
    const selectedFeedErrors = selectedFeedStatus?.errors;
    const [feedErrorKey, feedErrorMessage] = Object.entries(workspaceCardFeedsErrors ?? selectedFeedErrors ?? {}).at(0) ?? [];
    const hasFeedErrors = !!feedErrorKey;

    {(isLoading || isFeedPending || isNoFeed) && !feedErrorKey && (
    <ScrollView>
    {isLoading && <TableRowSkeleton fixedNumItems={5} />}
    {!isLoading && isFeedPending && (
    <View style={styles.flex1}>
    <WorkspaceCompanyCardsFeedPendingPage />
    </View>
    )}
    {!isLoading && isNoFeed && (
    <View style={styles.flex1}>
    <WorkspaceCompanyCardPageEmptyState
    policyID={policyID}
    shouldShowGBDisclaimer={shouldShowGBDisclaimer}
    />
    </View>
    )}
    </ScrollView>
    )}
    {!!feedErrorKey && !isLoading && (

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

    The fix requires two small changes, both focused on handling the case where domainOrWorkspaceAccountID equals CONST.DEFAULT_NUMBER_ID.

    In src/pages/workspace/companyCards/WorkspaceCompanyCardsTable/index.tsx, the workspaceCardFeedsErrors computation (around line 98) should detect when domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID and the user is not offline, and treat this as a workspace feeds load error directly rather than relying on Onyx-stored error data. The logic would check domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && !isOffline and, when true, synthesize the same error object that the openPolicyCompanyCardsPage failure handler would have written: { [CONST.COMPANY_CARDS.WORKSPACE_FEEDS_LOAD_ERROR]: translate('workspace.companyCards.error.workspaceFeedsCouldNotBeLoadedMessage') }. This feeds into the existing feedErrorKey / feedErrorMessage / feedErrorTitle logic and the error BlockingView at line 377 renders correctly, reusing all the existing error UI code without any new components or props.

    const areWorkspaceCardFeedsLoading = !!workspaceCardFeedsStatus?.[domainOrWorkspaceAccountID]?.isLoading;
    const workspaceCardFeedsErrors = workspaceCardFeedsStatus?.[domainOrWorkspaceAccountID]?.errors;
    const selectedFeedStatus = selectedFeed?.status;
    const selectedFeedErrors = selectedFeedStatus?.errors;
    const [feedErrorKey, feedErrorMessage] = Object.entries(workspaceCardFeedsErrors ?? selectedFeedErrors ?? {}).at(0) ?? [];
    const hasFeedErrors = !!feedErrorKey;
    let feedErrorTitle: string | undefined;
    let feedErrorReloadAction: (() => void) | undefined;
    if (feedErrorKey === CONST.COMPANY_CARDS.WORKSPACE_FEEDS_LOAD_ERROR) {
    feedErrorTitle = translate('workspace.companyCards.error.workspaceFeedsCouldNotBeLoadedTitle');
    feedErrorReloadAction = onReloadPage;
    } else if (feedErrorKey === CONST.COMPANY_CARDS.FEED_LOAD_ERROR) {
    feedErrorTitle = translate('workspace.companyCards.error.feedCouldNotBeLoadedTitle');
    feedErrorReloadAction = onReloadFeed;
    }

    In src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx, the loadPolicyCompanyCardsPage callback (line 47) should include an early return when domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID to avoid making a useless API call whose result would be silently discarded by Onyx anyway. This also ensures that when the user taps "Try Again" on the error UI, the retry only fires once the workspace has been properly created and has a valid workspaceAccountID. When the network recovers and the workspace creation succeeds, workspaceAccountID becomes a valid non-zero number, the domainOrWorkspaceAccountID value changes, the useEffect dependency triggers a re-run, and the openPolicyCompanyCardsPage call proceeds with a valid key.

    const loadPolicyCompanyCardsPage = useCallback(() => {
    openPolicyCompanyCardsPage(policyID, domainOrWorkspaceAccountID, translate);
    }, [domainOrWorkspaceAccountID, policyID, translate]);
    const {isOffline} = useNetwork({
    onReconnect: loadPolicyCompanyCardsPage,
    });
    const isLoading = !isOffline && (!allCardFeeds || (isFeedAdded && isLoadingOnyxValue(cardListMetadata)));
    useEffect(() => {
    if (isOffline) {
    return;
    }
    loadPolicyCompanyCardsPage();
    }, [policyID, domainOrWorkspaceAccountID, loadPolicyCompanyCardsPage, isOffline]);

    What alternative solutions did you explore? (Optional)

    N/A

  6. khaoticvs commented on Jan 31, 2026

    @khaoticvs

    One thing to double-check: when the workspace is created optimistically and the network is failing, workspaceAccountID can be undefined and fall back to DEFAULT_NUMBER_ID (0). Since Onyx skips collection member ID "0", any failure data written there will be dropped silently.

    Two possible mitigations to consider:

    1. Guard the read: early-return from openPolicyCompanyCardsPage when domainOrWorkspaceAccountID === DEFAULT_NUMBER_ID, so we don’t issue a no-op request.
    2. UI fallback: when online and domainOrWorkspaceAccountID === DEFAULT_NUMBER_ID after policy load, synthesize a WORKSPACE_FEEDS_LOAD_ERROR locally so the existing error UI can render.

    Both approaches keep the fix localized without changing global Onyx behavior.

  7. melvin-bot commented on Jan 31, 2026

    @melvin-bot

    📣 @khaoticvs! 📣
    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>
    
  8. melvin-bot commented on Feb 4, 2026

    @melvin-bot

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

  9. brianlee-expensify commented on Feb 5, 2026

    @brianlee-expensify
    Contributor

    @Ollyws any updates here?

  10. 24 remaining items

  11. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  12. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.21-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-02-25. 🎊

    For reference, here are some details about the assignees on this issue:

    • @Ollyws requires payment through NewDot Manual Requests
    • @MobileMage requires payment (Needs manual offer from BZ)
  13. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    @Ollyws @brianlee-expensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  14. brianlee-expensify commented on Feb 19, 2026

    @brianlee-expensify
    Contributor

    @MobileMage can you share your upwork profile so i can assign you this job?

  15. brianlee-expensify commented on Feb 19, 2026

    @brianlee-expensify
    Contributor

    @Ollyws can you fill out the bugzero checklist and confirm whether a regression test is needed? thanks in advance!

  16. MobileMage commented on Feb 19, 2026

    @MobileMage
    Contributor
  17. brianlee-expensify commented on Feb 25, 2026

    @brianlee-expensify
    Contributor

    @Ollyws can you fill out the bugzero checklist and confirm whether a regression test is needed? thanks in advance!

  18. brianlee-expensify commented on Feb 26, 2026

    @brianlee-expensify
    Contributor

    bump for @Ollyws

  19. Ollyws commented on Feb 26, 2026

    @Ollyws
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on both staging and production
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/80734/changes#r2859152923

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template

    Regression Test Proposal

    Precondition:

    Test:

    1. Create a new workspace with 'simulate failing network requests' enabled in dev settings
    2. Navigate to Company Cards page for that workspace
    3. Verify the error BlockingView is displayed
    

    Do we agree 👍 or 👎

  20. brianlee-expensify commented on Feb 26, 2026

    @brianlee-expensify
    Contributor

    Payment Summary

  21. Ollyws commented on Feb 27, 2026

    @Ollyws
    Contributor

    Requested in ND.

  22. trjExpensify commented on Mar 2, 2026

    @trjExpensify
    Contributor

    approved $250 for @Ollyws.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions