[$175] Web - Company Cards - page loading infinitely with 'simulate failing network request'
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: undefined Reproducible in staging?: Yes Reproducible in production?: undefined If this was caught during regression testing, add the test name, ID and link from BrowserStack: undefined Email or phone of affected tester (no customers): undefined Issue reported by: Applause Internal Team Bug source: undefined Device used: undefined App Component: undefined
Action Performed:
- Create a new workspace with 'simulate failing network requests' enabled in dev settings
- Navigate to Company Cards page for that workspace
Expected Result:
the error BlockingView is displayed
Actual Result:
page loading infinitely instead of error shown
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [ ] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [ ] MacOS: Chrome / Safari
Screenshots/Videos
https://github.com/user-attachments/assets/5ebb1762-a460-4aaf-8308-49021beaf54f
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022119825058383936601
- Upwork Job ID: 2119825058383936601
- Last Price Increase: 2026-11-09
Issue Owner
Current Issue Owner: @cretadn22
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External)
Job added to Upwork: https://www.upwork.com/jobs/~022119825058383936601
🤖 Web test steps verification results: ⚠️ partial
Verification was blocked during setup on dev NewDot web. The reported behavior could not be confirmed or disproved.

| Step | Status |
|---|---|
Enable simulated failing network requests and create a workspaceSetup was blocked: Global Search input attempts were rejected as covered by a dialog. No workspace was created.![]() |
❌ |
Determine whether Company Cards displays an error BlockingView or persistent loadingNot tested because the required workspace fixture could not be established. |
❌ |
Proposal
Confidence: Medium — the code explains the reported behavior, but runtime reproduction remains unverified.
What is the root cause of that problem?
Company Cards conflates an unresolved workspace account ID with an indefinitely pending request. Following simulated workspace-creation failure, the optimistic workspace remains without policyAccountID. The screen keeps showing loading, while its fallback error requires that same account-resolution wait to have finished.
Code evidence and alternative explanation checked
- The optimistic workspace does not include
policyAccountID, and creation failure preserves that workspace: Policy.ts:2973–3073, failure handling:3266–3295. - The missing account ID makes
isPolicyLoaded=false: WorkspaceCompanyCardsPage.tsx:93–122. - The cards action intentionally omits loading/error updates for fallback account ID
0. For valid account IDs, failure already clearsisLoading, ruling out a generally missing reset: CompanyCards.ts:1095–1157. - The table requires
isPolicyLoadedto generate its missing-account error, while!isPolicyLoadedforces loading. BlockingView additionally requires loading to stop: table:145–185, rendering:539–576.
The simulator discards responses after server processing; this does not prove workspace creation failed server-side: HttpUtils.ts:120–150.
What changes do you think we should make in order to solve the problem?
Track the Company Cards page request’s pending/success/failure state by policy ID, independently of account-ID availability.
Pass terminal workspace-page errors explicitly to the table and let them display BlockingView instead of the initial loader. Preserve loading while creation genuinely remains pending; do not simply treat every missing account ID as an error.
Retry should clear the error and restart loading. Recovery after a lost creation response also needs verification: repeating the cards request alone is not proven to refresh the missing account ID.
Suggested regression coverage
Extend the existing page tests and table tests to verify:
- Unresolved account ID plus terminal failure shows BlockingView.
- Genuine pending creation retains the spinner without flashing an error.
- Terminal page failure is not hidden by other initial-loading guards.
- Retry failure remains actionable; successful account resolution restores normal rendering.
No source changes or automated tests were performed.
What alternative solutions did you explore? (Optional)
Simply setting isPolicyLoaded=true on failure is insufficient: other loading guards can still suppress BlockingView. Explicit terminal-error handling avoids misrepresenting the workspace as loaded.
Possibly related: Company Card — Infinite loading after going online also involves opening Company Cards around workspace creation/connectivity changes. A shared root cause is not established.
Next Steps for Contributor+ team:
To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106395) to create a draft PR.
To refine: @MelvinBot <your feedback>
To reject: Explain why you are rejecting Melvin's proposal.
Proposal
What is the root cause of that problem?
In src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx:
// A freshly created workspace has no account ID until the back end returns one, so we can't treat the policy as loaded yet.
// Offline that response can never arrive, so we consider the policy loaded to avoid showing a spinner that would never resolve.
const isPolicyLoaded = !!policy && (policy.policyAccountID !== undefined || isOffline);
- When workspace creation fails (e.g. simulated network failure), the policy creation request fails and error state is set on
policy.errors. Because creation failed, a backend response assigningpolicyAccountIDwill never arrive. - Because the user is technically online (
isOffline === false),isPolicyLoadedevaluates tofalseindefinitely. - In
src/components/Tables/WorkspaceCompanyCardsTable/index.tsx:shouldShowWorkspaceFeedsLoadErrorrequiresisPolicyLoaded === trueto locally synthesizeCONST.COMPANY_CARDS.WORKSPACE_FEEDS_LOAD_ERROR(since Onyx discards writes to collection keys with member ID0). BecauseisPolicyLoadedisfalse, the error is never synthesized.isLoadingFeedevaluates!isPolicyLoadedastrue, causingisLoadingto remaintrueforever.- Consequently,
<Table.LoadingState />is rendered indefinitely, and the errorBlockingView(which requires!isLoading) can never be rendered.
What changes do you think we should make in order to solve the problem?
- In
src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx: UpdateisPolicyLoadedto also consider the policy loaded if creation has failed andpolicy.errorsis populated (matching the pattern used across workspace pages via!isEmptyObject(policy.errors)):
const isPolicyLoaded = !!policy && (policy.policyAccountID !== undefined || isOffline || !isEmptyObject(policy.errors));
- In
src/components/Tables/WorkspaceCompanyCardsTable/index.tsx: GuardisLoadingFeedso that ifhasFeedErrorsis true, feed loading state does not suppress the error view:
const isLoadingFeed = !hasCards && !hasFeedErrors && ((!feedName && isInitiallyLoadingFeeds) || !isPolicyLoaded || isLoadingOnyxFeed || isSelectedFeedLoading);
This guarantees that:
- When workspace creation fails,
isPolicyLoadedresolves totrue. shouldShowWorkspaceFeedsLoadErrorsynthesizes the error correctly for workspace account ID0.isLoadingstops immediately and the errorBlockingViewwith the "Try Again" button is displayed as expected.
What alternative solutions did you explore? (Optional)
We could remove the optimistic policy on creation failure. However, Expensify's architecture intentionally preserves the optimistic policy with RBR error state in Onyx so the user can inspect errors and retry. Updating isPolicyLoaded to recognize !isEmptyObject(policy.errors) respects this architecture and aligns WorkspaceCompanyCardsPage with the rest of the workspace settings screens.
Tests
- Enable 'Simulate failing network requests' in Settings > Developer settings.
- Create a new workspace.
- Navigate to the Company Cards page for that workspace.
- Verify that the error
BlockingView("Workspace feeds could not be loaded" / "Try Again") is displayed instead of an infinite loading spinner. - Turn off 'Simulate failing network requests' and click 'Try Again'.
- Verify normal loading and feed resolution behavior.
- Contributor: @kevinjosh10
- Expensify Account Email: [email protected]
- Upwork Profile: https://www.upwork.com/freelancers/~0131dae36abcf59374
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0179cdc82689f205c7
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web, when navigating to the Workspace Company Cards page with simulated failing network requests enabled, the page remains stuck in an infinite loading skeleton/spinner with no error state or recovery mechanism.
What is the root cause of that problem?
In src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx, the loading indicator condition depends on isLoading from card feed queries. When the network request fails, the API failure handler fails to clear the pending loading flag in Onyx or local state, leaving isLoading true indefinitely while no retry CTA or offline indicator is rendered.
What changes do you think we should make in order to solve the problem?
- In
src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx, verifyisOfflineandpolicy.errorsalongsideisLoading. - When a network error occurs, ensure
isLoadingis set to false and renderFullScreenLoadingIndicatorfallback orBlockingViewwith an explicit retry button. - Ensure the API failure callback for
OpenPolicyCompanyCardsPageresets the loading state in Onyx.
What alternative solutions did you explore? (Optional)
- Global timeout force-refresh: Rejected because individual pages should gracefully display localized error boundaries and offline indicators per Expensify design standards.
What automated tests can you add to prevent this from re-occurring?
In tests/unit/WorkspaceCompanyCardsPageTest.ts:
- Add a test verifying that when company card feeds fail to load due to a network error, the page stops showing the loading spinner and renders an error/retry state.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
On Web, when navigating to the Workspace Company Cards page for a newly created workspace while "Simulate failing network requests" is enabled, the page is stuck in an infinite loading spinner instead of displaying the error BlockingView with a "Try Again" recovery button.
What is the root cause of that problem?
There is a dual deadlock between isPolicyLoaded in WorkspaceCompanyCardsPage.tsx and the error/loading state evaluation in WorkspaceCompanyCardsTable/index.tsx:
-
isPolicyLoadedremainsfalseforever on failed creation: Insrc/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx:93:const isPolicyLoaded = !!policy && (policy.policyAccountID !== undefined || isOffline);When workspace creation fails under simulated network failure:
- The device is still online (
isOffline === false). - The optimistic policy is preserved in Onyx with error state (
policy.errors/ Red Brick Road), butpolicy.policyAccountIDremainsundefinedbecause the backend creation request failed. - Because
policyAccountIDisundefinedandisOfflineisfalse,isPolicyLoadedevaluates tofalseindefinitely.
- The device is still online (
-
Error synthesis is blocked by
isPolicyLoaded: Insrc/components/Tables/WorkspaceCompanyCardsTable/index.tsx:146:const shouldShowWorkspaceFeedsLoadError = domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && isPolicyLoaded && !isOffline;Because
isPolicyLoadedisfalse,shouldShowWorkspaceFeedsLoadErrorevaluates tofalse. Therefore, the table never synthesizesCONST.COMPANY_CARDS.WORKSPACE_FEEDS_LOAD_ERROR, leavinghasFeedErrors === false. -
isLoadingFeedis stucktruedue to!isPolicyLoaded: Insrc/components/Tables/WorkspaceCompanyCardsTable/index.tsx:184-185:const isLoadingFeed = !hasCards && ((!feedName && isInitiallyLoadingFeeds) || !isPolicyLoaded || isLoadingOnyxFeed || isSelectedFeedLoading); const isLoading = isLoadingPage || isLoadingFeed || isLoadingOnyxCardList;Because
!isPolicyLoadedistrue,isLoadingFeed(and consequentlyisLoading) evaluates totrueindefinitely. -
BlockingViewerror is suppressed byisLoading: Insrc/components/Tables/WorkspaceCompanyCardsTable/index.tsx:556: The error view requires{!!feedErrorKey && !isLoading && (...). BecauseisLoadingis stuck attrue, the errorBlockingViewis never rendered, and the user is trapped watching the infinite loading spinner<Table.LoadingState />.
What changes do you think we should make in order to solve the problem?
-
Update
isPolicyLoadedinWorkspaceCompanyCardsPage.tsx: Recognize that if a policy has failed creation and holds errors (!isEmptyObject(policy.errors)), the policy is loaded as far as the client is concerned (no server account ID will arrive without a retry):// In src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx: import {isEmptyObject} from '@src/types/utils/EmptyObject'; // A freshly created workspace has no account ID until the back end returns one, so we can't treat the policy as loaded yet. // Offline or on creation failure, that response can never arrive, so we consider the policy loaded to avoid showing a spinner that would never resolve. const isPolicyLoaded = !!policy && (policy.policyAccountID !== undefined || isOffline || !isEmptyObject(policy.errors)); -
Guard
isLoadingFeedwith!hasFeedErrorsinWorkspaceCompanyCardsTable/index.tsx: Ensure feed loading state does not override an active feed error:// In src/components/Tables/WorkspaceCompanyCardsTable/index.tsx: const isLoadingFeed = !hasCards && !hasFeedErrors && ((!feedName && isInitiallyLoadingFeeds) || !isPolicyLoaded || isLoadingOnyxFeed || isSelectedFeedLoading);
With these two surgical changes:
- When workspace creation fails,
isPolicyLoadedevaluates totrue. shouldShowWorkspaceFeedsLoadErrorcleanly synthesizesCONST.COMPANY_CARDS.WORKSPACE_FEEDS_LOAD_ERRORfor workspace account ID0.isLoadingFeedstops loading (isLoading === false).- The error
BlockingViewrenders with theTry AgainCTA button linked toonReloadPage. - When network is restored and the user taps
Try Again,openPolicyCompanyCardsPageis re-triggered cleanly.
What alternative solutions did you explore? (Optional)
- Discarding the optimistic policy in Onyx on creation failure: Rejected because Expensify intentionally preserves failed optimistic policies so users can see the Red Brick Road error and retry.
- Overriding
isLoadingglobally whenpolicy.errorsis non-empty: Rejected as too broad, which could inadvertently suppress valid loading states on other sub-components. Restricting the change toisPolicyLoadedand guardingisLoadingFeedwith!hasFeedErrorsis minimal, surgical, and follows existing workspace patterns.
What specific scenarios should we cover in automated tests?
In tests/ui/WorkspaceCompanyCardsTableTest.tsx:
- Render error BlockingView on failed workspace creation:
- Render
WorkspaceCompanyCardsTablewithdomainOrWorkspaceAccountID = CONST.DEFAULT_NUMBER_ID,isPolicyLoaded = true, andisOffline = false. - Verify that
<Table.LoadingState />is not rendered. - Verify that
BlockingViewis rendered withworkspaceFeedsCouldNotBeLoadedTitleand the "Try Again" button.
- Render
- In
tests/ui/WorkspaceCompanyCardsPageSelectionModeTest.tsx:- Verify
isPolicyLoadedresolves totruewhenpolicy.policyAccountIDisundefinedbutpolicy.errorsis populated.
- Verify
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~013bdd0475abb70c10
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Reproduction notes — staging v9.5.35-1, Chrome on macOS, November 10.
I followed the issue steps with Simulate failing network requests enabled and Force offline disabled. One fresh workspace reached the expected “Couldn’t load card feeds” error with Try again. After confirming the failure setting in the same tab, a second fresh workspace stayed on the Company Cards spinner for several minutes, with no error or retry button.
A masked Onyx export taken while the second page was stuck showed:
| Workspace result | policyAccountID |
policy.errors |
policy.errorFields |
|---|---|---|---|
| Error view with retry | Present | Absent | Absent |
| Persistent spinner | Absent | Absent | Absent |
This supports the account-ID/loading deadlock described in MelvinBot’s proposal, and gives a case an errors-only policy guard would miss.
Disabling simulated failures did not clear the already-mounted spinner at the next observation. Reloading with normal requests restored the normal BYOC/Add cards page. This does not establish that creation failed server-side: the simulator discards the response after server processing.
These are reproduction observations only; I have not applied a fix or run automated tests. The full state export contains unrelated account data and is not attached.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a new workspace while Simulate failing network requests is enabled and navigating to the Company Cards page for that workspace, the page gets stuck in an infinite loading spinner instead of displaying the error BlockingView with a Try again button.
What is the root cause of that problem?
Two conditions combine to lock the Company Cards table in a permanent loading state when workspace creation fails without resolving policy.policyAccountID:
isPolicyLoadedstaysfalsewhenpolicy.policyAccountIDis unresolved, andcreateWorkspacedoes not setpolicy.errors:- In
WorkspaceCompanyCardsPage.tsx,isPolicyLoadedonly becomestruewhenpolicy.policyAccountID !== undefined || isOffline. - In
Policy.ts,createWorkspacefailureDatamerges{employeeList: null, owner, ownerAccountID}intopolicy_${policyID}and never setspolicy.errors. When workspace creation fails with a simulated network error, bothpolicy.policyAccountIDandpolicy.errorsremainundefinedwhileisOfflineisfalse, soisPolicyLoadedstaysfalse.
- In
openPolicyCompanyCardsPageskips all loading/error writes whendomainOrWorkspaceAccountID === 0(CONST.DEFAULT_NUMBER_ID):- In
CompanyCards.ts,onyxLoadingStateUpdatesisdomainOrWorkspaceAccountID !== CONST.DEFAULT_NUMBER_ID. WhenpolicyAccountIDisundefined,domainOrWorkspaceAccountIDdefaults to0, sooptimisticData,successData, andfailureDataare all empty arrays ([]). - When
OPEN_POLICY_COMPANY_CARDS_PAGEfails immediately due to simulated network failure, no failure state is recorded anywhere in Onyx. - In
WorkspaceCompanyCardsTable/index.tsx,shouldShowWorkspaceFeedsLoadErrorrequiresisPolicyLoaded, andisLoadingFeedincludes!isPolicyLoaded, so<Table.LoadingState />renders indefinitely and the errorBlockingView({!!feedErrorKey && !isLoading}) can never appear.
- In
What changes do you think we should make in order to solve the problem?
Follow the existing Expensify Card pattern (openPolicyExpensifyCardsPage with RAM_ONLY_EXPENSIFY_CARD_LOADING_STATE keyed by policyID) using ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE:
- Extend
CompanyCardsLoadingState(src/types/onyx/CompanyCardsLoadingState.ts) with optional policy-scoped fieldsisPageLoading?: booleanandhasPageLoadError?: boolean. - Track page load & failure state unconditionally by
policyIDinopenPolicyCompanyCardsPage(src/libs/actions/CompanyCards.ts):optimisticData: set{isPageLoading: true, hasPageLoadError: false}on${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID}(regardless of whetherdomainOrWorkspaceAccountID === 0).successData: set{isPageLoading: false, hasPageLoadError: false, hasOnceLoadedPage: true}.failureData: set{isPageLoading: false, hasPageLoadError: true}while preserving existing domain-keyedSHARED_NVP_PRIVATE_DOMAIN_MEMBERwrites whendomainOrWorkspaceAccountID !== CONST.DEFAULT_NUMBER_ID.
- Update
WorkspaceCompanyCardsPage.tsxandWorkspaceCompanyCardsTable/index.tsx:- Read
${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID}. - Allow
isPolicyLoadedto resolve whenpolicyCompanyCardsLoadingState?.hasOnceLoadedPageis true so a successful retry unblocks the table even if the earlierCreateWorkspaceresponse was discarded. - In
WorkspaceCompanyCardsTable, derivehasPageLoadError = !!policyCardsLoadingState?.hasPageLoadError && !policyCardsLoadingState?.isPageLoading. When!isOffline && hasPageLoadError, surfaceWORKSPACE_FEEDS_LOAD_ERRORand bypass the!isPolicyLoadedhold inisLoadingFeedsoBlockingViewwith Try again renders cleanly. WhileCreateWorkspaceis genuinely pending (!hasPageLoadError) or retrying (isPageLoading === true), keep showing<Table.LoadingState />.
- Read
- Add regression unit tests in
tests/ui/WorkspaceCompanyCardsTableTest.tsxcovering failed page fetches withisPolicyLoaded: false/domainOrWorkspaceAccountID: 0and returning to the loading indicator on retry.
Verified branch & compare: https://github.com/Expensify/App/compare/main...bhomvratrai-glitch:App:fix/106395-company-cards-infinite-loading
What alternative solutions did you explore? (Optional)
- Checking
!isEmptyObject(policy.errors)inisPolicyLoaded: Rejected becausePolicy.createWorkspace'sfailureDatadoes not setpolicy.errorsin Onyx (confirmed inPolicy.ts:3266-3275and in the Onyx dump above wherepolicyAccountIDandpolicy.errorsare both absent), so an errors-only guard still leaves the page stuck in an infinite spinner. - Decoupling
shouldShowWorkspaceFeedsLoadErrorfromisPolicyLoaded(domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && !isOffline) or markingisPolicyLoaded = trueunconditionally: Rejected because it prematurely flashes the errorBlockingViewwhile a new workspace'sCreateWorkspacerequest is still genuinely in flight, breaking the existing regression test inWorkspaceCompanyCardsTableTest.tsx:292-299("keeps the loading indicator up instead of flashing the feeds load error while the policy account ID is unresolved").
Thanks @Shivam1817 for the reproduction data! This confirms the exact deadlock between isPolicyLoaded and the synthesized error check in WorkspaceCompanyCardsTable:
-
Why
domainOrWorkspaceAccountID === 0skips Onyx error writes:
Insrc/libs/actions/CompanyCards.ts(line 1096):const onyxLoadingStateUpdates = domainOrWorkspaceAccountID !== CONST.DEFAULT_NUMBER_ID;When
policyAccountIDis missing,domainOrWorkspaceAccountIDis0, soCompanyCards.tsintentionally avoids writingfailureDatato Onyx because collection keys ending in0are ignored. -
The deadlock in
WorkspaceCompanyCardsTable:
To compensate for this, line 146 attempts to synthesize the error:const shouldShowWorkspaceFeedsLoadError = domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && isPolicyLoaded && !isOffline;However, because
isPolicyLoadedinWorkspaceCompanyCardsPage.tsxrequirespolicy.policyAccountID !== undefined || isOffline, when online without an account ID,isPolicyLoadedisfalse. Thus,shouldShowWorkspaceFeedsLoadErroris never set, while!isPolicyLoadedinisLoadingFeed(line 184) keeps the page stuck inisLoadingindefinitely. -
Surgical Solution:
Insrc/components/Tables/WorkspaceCompanyCardsTable/index.tsx:- Decouple
shouldShowWorkspaceFeedsLoadErrorfromisPolicyLoaded:const shouldShowWorkspaceFeedsLoadError = domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && !isOffline; - Guard
isLoadingFeedwith!hasFeedErrors:const isLoadingFeed = !hasCards && !hasFeedErrors && ((!feedName && isInitiallyLoadingFeeds) || !isPolicyLoaded || isLoadingOnyxFeed || isSelectedFeedLoading);
- Decouple
This guarantees that whenever domainOrWorkspaceAccountID === 0 online, the synthesized error is recognized, isLoadingFeed yields to the error state, and the BlockingView with "Try Again" is displayed immediately, regardless of whether policy.errors is present or absent in Onyx.
@aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a new workspace while Simulate failing network requests is enabled in developer settings and navigating to the Company Cards page for that workspace, the page gets stuck in an infinite loading spinner instead of displaying the error BlockingView with a Try again button.
What is the root cause of that problem?
The infinite spinner is caused by a loading/error state deadlock when policy.policyAccountID has not resolved yet (domainOrWorkspaceAccountID === 0):
-
isPolicyLoadedstaysfalsewhenCreateWorkspacefails (WorkspaceCompanyCardsPage.tsx:104):- In
src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx:104:const isPolicyLoaded = !!policy && (policy.policyAccountID !== undefined || isOffline); - When
CreateWorkspacefails due to simulated network failure,src/libs/actions/Policy/Policy.ts:3266-3275(failureData) merges{employeeList: null, owner, ownerAccountID}intopolicy_${policyID}and never setspolicy.errorsorpolicy.policyAccountID. Because the client is still online (isOffline === false),isPolicyLoadedremainsfalseindefinitely.
- In
-
openPolicyCompanyCardsPagedrops all loading/success/failure Onyx updates whendomainOrWorkspaceAccountID === 0(CompanyCards.ts:1097-1146):- Because Onyx skips collection writes to member ID
'0'(CONST.SKIPPABLE_COLLECTION_MEMBER_IDS),openPolicyCompanyCardsPagegatesoptimisticData,successData, andfailureDatabehindconst onyxLoadingStateUpdates = domainOrWorkspaceAccountID !== CONST.DEFAULT_NUMBER_ID;. - When
policy.policyAccountIDisundefined,domainOrWorkspaceAccountIDfalls back to0, soopenPolicyCompanyCardsPagesendsOPEN_POLICY_COMPANY_CARDS_PAGEwithoptimisticData: [],successData: [], andfailureData: []. When that request fails, no error or settled flag is written anywhere in Onyx.
- Because Onyx skips collection writes to member ID
-
Three separate loading guards in
WorkspaceCompanyCardsTable/index.tsxkeepisLoading === true:- Guard A (
shouldShowWorkspaceFeedsLoadError, line147):domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && isPolicyLoaded && !isOfflineevaluates tofalsebecauseisPolicyLoadedisfalse, sohasFeedErrorsremainsfalse. - Guard B (
isLoadingFeed, line185): includes!isPolicyLoaded, forcingisLoadingFeed = true. - Guard C (
isLoadingPage, lines141,176-177,184):hasOnceLoadedPageis read only from${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${domainOrWorkspaceAccountID}(companyCardsLoadingState_0, which Onyx skips!). Even if the user disables simulated failures and taps Try again soOPEN_POLICY_COMPANY_CARDS_PAGEsucceeds for a workspace with 0 card feeds (allCardFeedsempty ->isPageFetchPending === true) whiledomainOrWorkspaceAccountIDis still0(because the earlierCreateWorkspaceresponse was discarded by the simulator),hasOnceLoadedPageoncompanyCardsLoadingState_0staysfalse, keepingareWorkspaceCardFeedsLoading = trueandisLoadingPage = trueforever on retry!
- Guard A (
What changes do we think we should make in order to solve the problem?
Mirror the exact policy-keyed pattern already established in openPolicyExpensifyCardsPage (src/libs/actions/Policy/Policy.ts:4474-4509 + src/types/onyx/ExpensifyCardLoadingState.ts + WorkspaceExpensifyCardPage.tsx:43-65), using ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE keyed by policyID (${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID} — a string policy ID never collides with numeric domainOrWorkspaceAccountID keys and is never skipped by SKIPPABLE_COLLECTION_MEMBER_IDS):
-
Extend
src/types/onyx/CompanyCardsLoadingState.ts: Add optional policy-scoped fieldsisLoadingPage?: booleanandhasLoadingError?: booleanalongsidehasOnceLoadedPage?: boolean:/** Whether the workspace company cards page request is currently in flight (keyed by policyID) */ isLoadingPage?: boolean; /** Whether the latest workspace company cards page request failed (keyed by policyID) */ hasLoadingError?: boolean; -
Record page-level loading, success, and failure unconditionally under
${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID}insrc/libs/actions/CompanyCards.ts(openPolicyCompanyCardsPage):optimisticData: always merge{isLoadingPage: true, hasLoadingError: false}into${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID}(and keep theSHARED_NVP_PRIVATE_DOMAIN_MEMBERwrite whenonyxLoadingStateUpdatesis true).successData: always merge{isLoadingPage: false, hasLoadingError: false, hasOnceLoadedPage: true}into${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID}(plus existing domain-keyed writes whenonyxLoadingStateUpdatesis true).failureData: always merge{isLoadingPage: false, hasLoadingError: true}into${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID}(plus existing domain-keyed error writes whenonyxLoadingStateUpdatesis true).
-
Unblock both initial failure AND retry success in
WorkspaceCompanyCardsPage.tsxandWorkspaceCompanyCardsTable/index.tsx:- In
src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx: Readconst [policyCompanyCardsLoadingState] = useOnyx(${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID});and updateisPolicyLoaded:const isPolicyLoaded = !!policy && (policy.policyAccountID !== undefined || isOffline || !!policyCompanyCardsLoadingState?.hasOnceLoadedPage); - In
src/components/Tables/WorkspaceCompanyCardsTable/index.tsx: Readconst [policyCompanyCardsLoadingState] = useOnyx(${ONYXKEYS.COLLECTION.RAM_ONLY_COMPANY_CARDS_LOADING_STATE}${policyID});and derive:- Combine
hasOnceLoadedPageacross both keys (critical for empty-workspace retry whendomainOrWorkspaceAccountID === 0):const hasOnceLoadedPage = !!companyCardsLoadingState?.hasOnceLoadedPage || !!policyCompanyCardsLoadingState?.hasOnceLoadedPage; const isPolicyPageLoading = !!policyCompanyCardsLoadingState?.isLoadingPage; const hasPolicyPageLoadError = !!policyCompanyCardsLoadingState?.hasLoadingError && !isPolicyPageLoading; - Synthesize
WORKSPACE_FEEDS_LOAD_ERRORwhenhasPolicyPageLoadErroris true (and clear it while retrying):const shouldShowWorkspaceFeedsLoadError = !isOffline && !isPolicyPageLoading && ((domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && (isPolicyLoaded || hasPolicyPageLoadError)) || (hasPolicyPageLoadError && !workspaceCardFeedsStatus?.[domainOrWorkspaceAccountID]?.errors)); - Include
isPolicyPageLoadinginareWorkspaceCardFeedsLoadingand release!isPolicyLoadedwhenhasFeedErrorsis active:const areWorkspaceCardFeedsLoading = (!!workspaceCardFeedsStatus?.[domainOrWorkspaceAccountID]?.isLoading || isPolicyPageLoading || isPageFetchAwaited) && !hasOnceLoadedPage; const isLoadingFeed = !hasCards && !hasFeedErrors && ((!feedName && isInitiallyLoadingFeeds) || !isPolicyLoaded || isLoadingOnyxFeed || isSelectedFeedLoading);
- Combine
- Add unit/UI tests in
tests/ui/WorkspaceCompanyCardsTableTest.tsxcovering: (a) unresolvedpolicyAccountIDwhileCreateWorkspace+ page fetch are still in flight keeps<Table.LoadingState />without flashing an error, (b) failed page fetch withdomainOrWorkspaceAccountID === 0rendersBlockingView+ Try again, (c) tapping Try again returns to<Table.LoadingState />whileisLoadingPage: true, and (d) successful retry on a workspace with no feeds (domainOrWorkspaceAccountID === 0,hasOnceLoadedPage: trueon policy key) rendersWorkspaceCompanyCardPageEmptyStateinstead of staying stuck onareWorkspaceCardFeedsLoading.
- In
What alternative solutions did you explore? (Optional)
- Checking
!isEmptyObject(policy.errors)inisPolicyLoaded: Does not work becausePolicy.createWorkspacefailureData(Policy.ts:3266-3275) never populatespolicy.errorsin Onyx, leavingisPolicyLoadedstuck atfalse. - Removing
isPolicyLoadedfromshouldShowWorkspaceFeedsLoadError(domainOrWorkspaceAccountID === CONST.DEFAULT_NUMBER_ID && !isOffline): Breaks normal workspace creation by immediately flashing theWORKSPACE_FEEDS_LOAD_ERRORBlockingViewwhileCreateWorkspaceandOpenPolicyCompanyCardsPageare legitimately in flight (failing the existing regression test inWorkspaceCompanyCardsTableTest.tsx:292-299). - Reading
hasOnceLoadedPageonly fromcompanyCardsLoadingState_${domainOrWorkspaceAccountID}insideWorkspaceCompanyCardsTable: LeaveshasOnceLoadedPage === falsewhen a retry succeeds whiledomainOrWorkspaceAccountIDis still0(because the initialCreateWorkspaceHTTP response was discarded by simulated failure), keepingisPageFetchAwaited && !hasOnceLoadedPagestuck in an infinite loading state on empty workspaces. Combining!!companyCardsLoadingState?.hasOnceLoadedPage || !!policyCompanyCardsLoadingState?.hasOnceLoadedPagecloses that retry deadlock completely.
@aimane-chnaif Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
@aimane-chnaif 10 days overdue. I'm getting more depressed than Marvin.
Claude posting on behalf of Matt:
@cretadn22 you're now the C+ on this issue. The previous C+ is no longer in the Contributor program. Next step: review the proposals.
@MelvinBot I was able to reproduce this bug on my end. Could you retry the reproduction steps and verify your original proposal?
🤖 Web test steps verification results: ⚠️ partial
Created a new workspace on dev NewDot web with simulated failures enabled and Force offline disabled. Automation could not navigate to Company Cards, so I could not confirm the reported behavior or verify my original proposal.

| Step | Status |
|---|---|
Create a workspace with simulated failures enabledEnabled simulated failures and confirmed the new workspace through UI read-back. Screenshot shows baseline settings before enabling failures.![]() |
✅ |
Navigate to Company CardsAutomation blocker: Company Cards was visible in the sidebar but absent from accessibility read-back. No supported navigation tool was available. This is not a confirmed product failure.![]() |
❌ |
Verify persistent loading versus error BlockingViewNot reached; neither outcome was verified. |
❌ |
Disable failures and verify recoveryDisabled simulated failures during cleanup. Company Cards recovery and Try again remain untested. |
❌ |
Verify the original proposalThe unresolved-account-ID hypothesis remains unconfirmed by this runtime attempt. My original proposal is still provisional—not a verified fix. No source changes were made. |
❌ |
@MelvinBot Implement this
🤖 Web test steps verification results: ❌ fail
Implemented in draft PR: Show Company Cards load errors and support retry recovery. The latest web recheck was blocked by a blank page, so revised retry recovery remains unverified.

| Step | Status |
|---|---|
Create a workspace with simulated failures enabledCreated the workspace with simulated failures enabled and Force offline off. |
✅ |
Verify actionable Company Cards failureDisplayed “Couldn't load card feeds” and “Try again” instead of endless loading. |
✅ |
Retry while failures remain enabledReturned to the actionable error; the brief loading transition was not captured. |
✅ |
Disable failures and retry recoveryThe first implementation remained in error. Recovery handling was subsequently revised.![]() |
❌ |
Recheck revised failure and recovery behaviorBlocked by a blank app page; no product verdict was possible.![]() |
❌ |
Confirm simulated failures are off after recheckSettings were inaccessible. The first test disabled failures; the recheck changed no settings. |
❌ |
Automated checks passed: 32 focused tests, lint, typecheck, spelling, explicit-file React Compiler checks, formatting hook, and Storybook smoke test. PR remains draft pending browser recovery verification.
view run · no recording available

