You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] Reports - New report defaults to the default workspace instead of the selected workspace #107683
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2
Version Number: 9.5.52-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#106464 Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5.1 Safari/Chrome, iPhone 13 iOS 26.6 App Component: Money Requests
changed the title [-]Reports - New report defaults to the default workspace instead of the selected workspace[/-][+][$175] Reports - New report defaults to the default workspace instead of the selected workspace[/+]on Nov 22, 2026
Reproduced from non-default Workspace B’s chat composer + menu: the expense starts in B, but selecting Create report switches it to default Workspace A. No expense was submitted.
Step
Status
Navigate into Workspace B without changing the defaultWorkspace A remained the default; B’s expense chat contained two open report cards.
✅
Open + → Create expense → ManualUsed B’s chat composer menu, not the global sidebar button. The form initially showed Workspace B.
✅
Report picker preserves Workspace B contextExisting reports belonged to B, but Create report displayed Workspace A.
❌
Selecting Create report retains Workspace BThe form switched to Workspace A. Persisted report ownership was not independently verified.
❌
Proposal
What is the root cause of that problem?
The Report picker discards the expense’s workspace when the selected report belongs to the current user and the expense is not per diem. This causes Create report to fall back to the saved default workspace—even though the expense and existing-report options correctly identify the non-default workspace.
Code evidence and alternative explanations
useReportPickerActions.ts:182–210 extracts the transaction’s workspace but passes undefined as the target policy for an ordinary expense owned by the current user.
The initial-context-loss hypothesis does not explain this reproduction: the manual form and existing-report options retained B until Create report was selected. The frontend fallback explains the observed switch without requiring a backend redirect.
Scope: Verified on development web through the chat composer. The global sidebar + entry point was not verified; it should not be conflated with this flow. No introducing PR was established.
What changes do you think we should make in order to solve the problem?
Preserve the explicit workspace-chat destination when creating a new report for a non-global expense. Do not discard it solely because the selected report belongs to the current user.
Next Steps for Contributor+ team: To accept:@MelvinBot implement this to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
When I create an expense from a non-default workspace and pick Create report in the Report field, the new report goes to my default workspace instead of the workspace I started the expense in.
What is the root cause of that problem?
The report picker decides where Create report goes with usePolicyForMovingExpenses. It passes targetExpensePolicyID as the preferred workspace:
targetExpensePolicyID is only set when the expense belongs to another user or is per diem. For my own regular expense it is always undefined, even when I'm creating the expense inside a specific workspace chat (transactionPolicyID, the workspace of the chat I started in, is already computed on L196 but not used here).
With no expensePolicyID, usePolicyForMovingExpenses falls back to the active/default workspace:
). Then handleRegularReportSelection moves the draft expense onto that new report, so the expense also switches to the default workspace. The list already uses the chat's workspace when creating an expense (selectedPolicyID,
), which is why the existing reports shown are from the right workspace but Create report isn't.
The comment there says "fall back to undefined to let the default workspace apply". That makes sense when moving an existing expense, but not when the expense is being created from a chosen workspace chat.
What changes do you think we should make in order to solve the problem?
In useReportPickerActions, when we're creating an expense (action === CREATE) and its participant is a workspace chat, pass that workspace (transactionPolicyID) to usePolicyForMovingExpenses as the preferred policy. Keep the current behavior for editing/moving existing expenses (still default workspace) and for other users' and per diem expenses.
usePolicyForMovingExpenses already checks that the preferred policy is valid (member, can create expenses, group policy, not pending delete, time tracking for time requests). If it isn't valid, it still falls back to the default workspace, so we don't add a new edge case.
The empty-report confirmation and the restricted-action check already use policyForMovingExpenses, so they follow the right workspace automatically.
What specific scenarios should we test?
Two workspaces, A default. From workspace B's chat: + > Create expense > Manual > Report > Create report. The report and the expense stay in B (web, iOS, Mac).
The same from workspace A still creates in A.
Editing an existing expense's report and choosing Create report keeps the current behavior.
Per diem, time and managed-card expenses are unchanged.
If I start in a workspace where I can't create expenses, it falls back to the default workspace as it does today.
Add a unit test in tests/ui/components/IOURequestStepReportNewReportTest.tsx covering a non-default workspace chat.
What alternative solutions did you explore? (Optional)
Using reportOrDraftReport?.policyID (the same source as selectedPolicyID) as the preferred policy for the create flow, so the list and Create report always use the same workspace.
In src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts (lines 196–210), targetExpensePolicyID determines which workspace Create report targets (both for creating the report in createReportForPolicy at lines 261–279 and for displaying the workspace subtitle on the Create report row via transactionPolicyID: targetExpensePolicyID at line 328 → IOURequestEditReportCommon.tsx:169).
Currently, line 201 only populates targetExpensePolicyID when ownerAccountID !== session?.accountID || isPerDiemTransaction, otherwise setting it to undefined:
When a workspace has no open reports yet, selectedReport is undefined, so ownerAccountID is undefined and ownerAccountID !== session?.accountID accidentally evaluates to true, preserving transactionPolicyID.
When the non-default workspace has open reports (as in the repro steps), selectedReport resolves to an open report owned by the current user (ownerAccountID === session?.accountID), so line 201 flips to false and discards the originating workspace (targetExpensePolicyID = undefined).
Passing undefined to usePolicyForMovingExpenses (src/hooks/usePolicyForMovingExpenses.ts:135–142) skips the preferred validExpensePolicyID branch and falls back to activePolicy (the user's default workspace). Meanwhile, selectedPolicyID at line 315 explicitly preserves reportOrDraftReport?.policyID ?? transactionPolicyID when !isEditing && !isFromGlobalCreate, which is why the picker lists Workspace B's existing reports while Create report targets default Workspace A and moves the draft expense there.
What changes do you think we should make in order to solve the problem?
In src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts:
Preserve the originating workspace during non-global expense creation:
Extend the targetExpensePolicyID condition at line 201 to also apply when creating a non-global expense (isCreateReport && !isFromGlobalCreate), resolving selectedReport?.policyID ?? reportOrDraftReport?.policyID ?? transactionPolicyID (aligned with selectedPolicyID at line 315 so both the existing-report list and Create report always use the same originating workspace, including when reportIDFromRoute is a generated ID or a workspace chat/report).
Keep !isFromGlobalCreate in the guard so Global Create (+ sidebar button, where selectedPolicyID is intentionally undefined to list reports across all workspaces and allow default/workspace-picker resolution via shouldSelectPolicy) is unaffected.
Keep isEditing, per-diem, time, managed-card, and other-owner flows untouched.
Because targetExpensePolicyID feeds both usePolicyForMovingExpenses (line 208) and listProps.transactionPolicyID (line 328 → IOURequestEditReportCommon.tsx:169), both the Create report row subtitle, restriction check (createReport), empty-report confirmation, and createReportForPolicy automatically target the originating non-default workspace across both the anchored dropdown and full-page report picker.
Add regression unit tests in tests/ui/components/IOURequestStepReportNewReportTest.tsx:
With Workspace A as default (activePolicyID) and Workspace B non-default (both containing open reports), open the Report picker while creating a manual expense in Workspace B's chat (isFromGlobalCreate: false) and assert that Create report displays and creates the new report on Workspace B (policyID: B) rather than Workspace A.
Verify Global Create (isFromGlobalCreate: true) and editing an existing expense (action: EDIT) preserve their existing fallback behavior.
What alternative solutions did you explore? (Optional)
Passing transactionPolicyID for all action === CREATE flows without checking !isFromGlobalCreate: Rejected because in Global Create (isFromGlobalCreate: true), selectedPolicyID is intentionally undefined so the picker spans all workspaces and Create report respects the default workspace / shouldSelectPolicy workspace selector flow.
Passing selectedPolicyID directly into usePolicyForMovingExpenses: Rejected because for editing another user's expense (isEditing === true and ownerAccountID !== session?.accountID), selectedPolicyID is undefined, whereas targetExpensePolicyID must still preserve selectedReport?.policyID ?? transactionPolicyID.
Please re-state the problem that we are trying to solve in this issue.
When initiating expense creation from a non-default workspace (Workspace B) with existing open reports and tapping on the Report field, selecting Create report creates the new report in the default workspace (Workspace A) instead of retaining the selected originating workspace (Workspace B).
What is the root cause of that problem?
In src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts (lines 196–210 & 315–328):
The Report picker correctly filters existing reports to Workspace B because line 315 preserves the originating policy:
For a user's own manual expense in a non-default workspace with open reports, selectedReport resolves to the user's existing open report (ownerAccountID === session?.accountID), so ownerAccountID !== session?.accountID is false. Consequently, targetExpensePolicyID is set to undefined.
targetExpensePolicyID is passed into usePolicyForMovingExpenses (line 208) and listProps.transactionPolicyID (line 328):
When targetExpensePolicyID is undefined, usePolicyForMovingExpenses falls back to activePolicy (the user's saved default workspace, Workspace A).
Therefore, the Create report action (and its subtitle) targets Workspace A instead of the active workspace (Workspace B) where expense creation was initiated.
What changes do you think we should make in order to solve the problem?
In src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts:
Update targetExpensePolicyID (line 201) to preserve the originating policy during non-global expense creation (!isFromGlobalCreate && !isEditing / isCreateReport):
Non-global expense creation initiated from a specific workspace chat or report retains that workspace for Create report.
Global Create (isFromGlobalCreate === true, via + in global LHN) continues to pass undefined, allowing standard default workspace resolution (shouldSelectPolicy).
Other-owner expenses and per-diem transactions continue to work as expected.
Both usePolicyForMovingExpenses and listProps.transactionPolicyID receive the consistent originating policyID.
What alternative solutions did you explore? (Optional)
Unconditionally setting targetExpensePolicyID = originatingPolicyID: Suboptimal because global create (isFromGlobalCreate) intentionally needs undefined to allow workspace selection. Checking !isFromGlobalCreate ensures global create flows remain intact.
@ZhenjaHorbach I reproduced this on web (video below) and with a unit test on main, and MelvinBot's root cause is right. The owner check comes from #87962, not #106464, and it never looks at action.
If the fix only checks action === CREATE, submitting a tracked expense to a workspace still goes to the default one. Using the same condition as selectedPolicyID (!isEditing && !isFromGlobalCreate) fixes both cases. Global create and editing keep the default workspace, and 362/362 related tests pass.
diff --git a/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts b/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts
index bbc20804b553..9a374c87019c 100644
--- a/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts
+++ b/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts
@@ -195,11 +195,11 @@ function useReportPickerActions({
const isUnreportedManagedCardTransaction = isUnreportedManagedCardTransactionUtil(transaction);
const transactionPolicyID = transaction?.participants?.at(0)?.isPolicyExpenseChat ? transaction?.participants.at(0)?.policyID : undefined;
- // When moving an expense that belongs to another user, or when the selection includes per diem
- // transactions, use the policy of their report (or the transaction's policy as fallback) so the
- // selected workspace is preserved.
- // For the current user's own non-per-diem expenses, fall back to undefined to let the default workspace apply.
- const targetExpensePolicyID = ownerAccountID !== session?.accountID || isPerDiemTransaction ? (selectedReport?.policyID ?? transactionPolicyID) : undefined;
+ // Keep the workspace of the expense when it belongs to another user, when it is a per diem expense, or when it is
+ // being created from a workspace chat, so "Create report" opens the report in the same workspace as the listed reports.
+ // Otherwise (editing the current user's own expense, or creating it from global create) let the default workspace apply.
+ const shouldKeepExpenseWorkspace = ownerAccountID !== session?.accountID || isPerDiemTransaction || (!isEditing && !isFromGlobalCreate);
+ const targetExpensePolicyID = shouldKeepExpenseWorkspace ? (selectedReport?.policyID ?? transactionPolicyID) : undefined;
// We need to fall back to transactionPolicyID because for a new workspace there is no report created yet
// and if we choose this workspace as participant we want to create a new report in the chosen workspace
diff --git a/tests/unit/hooks/useReportPickerActionsTest.tsx b/tests/unit/hooks/useReportPickerActionsTest.tsx
new file mode 100644
index 000000000000..d57e8db101f2
--- /dev/null
+++ b/tests/unit/hooks/useReportPickerActionsTest.tsx
@@ -0,0 +1,172 @@
+import {renderHook, waitFor} from '@testing-library/react-native';
+
+import ActivePolicyProvider from '@components/ActivePolicyProvider';
+import OnyxListItemProvider from '@components/OnyxListItemProvider';
+
+import useReportPickerActions from '@pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions';
+
+import CONST from '@src/CONST';
+import ONYXKEYS from '@src/ONYXKEYS';
+import type {Transaction} from '@src/types/onyx';
+
+import type {ReactNode} from 'react';
+
+import React from 'react';
+import Onyx from 'react-native-onyx';
+
+import createRandomPolicy from '../../utils/collections/policies';
+import {createPolicyExpenseChat, createRandomReport} from '../../utils/collections/reports';
+import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates';
+
+jest.mock('@libs/Navigation/navigationRef', () => ({
+ getCurrentRoute: jest.fn(() => ({name: 'Dynamic_Money_Request_Report', params: {}})),
+ getState: jest.fn(() => ({})),
+ isReady: jest.fn(() => false),
+ addListener: jest.fn(() => jest.fn()),
+}));
+
+jest.mock('@libs/Navigation/Navigation', () => ({
+ navigate: jest.fn(),
+ goBack: jest.fn(),
+ navigationRef: {getCurrentRoute: jest.fn(() => ({name: 'Dynamic_Money_Request_Report', params: {}})), getState: jest.fn(() => ({}))},
+ getActiveRoute: () => '',
+ getActiveRouteWithoutParams: jest.fn(() => ''),
+ isNavigationReady: jest.fn(() => Promise.resolve()),
+}));
+
+jest.mock('@react-navigation/native', () => ({
+ ...jest.requireActual<Record<string, unknown>>('@react-navigation/native'),
+ useIsFocused: () => true,
+ useNavigation: () => ({navigate: jest.fn(), addListener: jest.fn()}),
+ useFocusEffect: jest.fn(),
+ usePreventRemove: jest.fn(),
+}));
+
+const ACCOUNT_ID = 1;
+const ACCOUNT_LOGIN = 'test@user.com';
+const DEFAULT_POLICY_ID = '1';
+const SELECTED_POLICY_ID = '2';
+const WORKSPACE_CHAT_ID = '20';
+const OPEN_REPORT_ID = '30';
+const TRANSACTION_ID = '1';
+
+function Wrapper({children}: {children: ReactNode}) {
+ return (
+ <OnyxListItemProvider>
+ <ActivePolicyProvider>{children}</ActivePolicyProvider>
+ </OnyxListItemProvider>
+ );
+}
+
+function buildPolicy(policyID: string) {
+ return {
+ ...createRandomPolicy(Number(policyID), CONST.POLICY.TYPE.TEAM),
+ id: policyID,
+ role: CONST.POLICY.ROLE.USER,
+ pendingAction: null,
+ employeeList: {[ACCOUNT_LOGIN]: {email: ACCOUNT_LOGIN, role: CONST.POLICY.ROLE.USER}},
+ };
+}
+
+function buildTransaction(isFromGlobalCreate: boolean): Transaction {
+ return {
+ transactionID: TRANSACTION_ID,
+ amount: 0,
+ currency: 'USD',
+ created: '2025-08-29',
+ merchant: '(none)',
+ reportID: OPEN_REPORT_ID,
+ isFromGlobalCreate,
+ participants: [{accountID: 0, reportID: WORKSPACE_CHAT_ID, policyID: SELECTED_POLICY_ID, isPolicyExpenseChat: true, selected: true}],
+ };
+}
+
+/** The current user has an open report in the non-default workspace's chat, and another workspace is set as default */
+async function givenOwnOpenReportInNonDefaultWorkspace() {
+ await Onyx.merge(ONYXKEYS.SESSION, {accountID: ACCOUNT_ID, email: ACCOUNT_LOGIN});
+ await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${DEFAULT_POLICY_ID}`, buildPolicy(DEFAULT_POLICY_ID));
+ await Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${SELECTED_POLICY_ID}`, buildPolicy(SELECTED_POLICY_ID));
+ await Onyx.set(ONYXKEYS.NVP_ACTIVE_POLICY_ID, DEFAULT_POLICY_ID);
+ await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${WORKSPACE_CHAT_ID}`, {
+ ...createPolicyExpenseChat(Number(WORKSPACE_CHAT_ID), true),
+ reportID: WORKSPACE_CHAT_ID,
+ policyID: SELECTED_POLICY_ID,
+ ownerAccountID: ACCOUNT_ID,
+ iouReportID: OPEN_REPORT_ID,
+ });
+ await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${OPEN_REPORT_ID}`, {
+ ...createRandomReport(Number(OPEN_REPORT_ID), undefined),
+ reportID: OPEN_REPORT_ID,
+ type: CONST.REPORT.TYPE.EXPENSE,
+ stateNum: CONST.REPORT.STATE_NUM.OPEN,
+ statusNum: CONST.REPORT.STATUS_NUM.OPEN,
+ policyID: SELECTED_POLICY_ID,
+ chatReportID: WORKSPACE_CHAT_ID,
+ ownerAccountID: ACCOUNT_ID,
+ managerID: ACCOUNT_ID,
+ });
+ await waitForBatchedUpdates();
+}
+
+function renderReportPickerActions(action: typeof CONST.IOU.ACTION.CREATE | typeof CONST.IOU.ACTION.EDIT, transaction: Transaction) {
+ return renderHook(
+ () =>
+ useReportPickerActions({
+ transaction,
+ transactionID: TRANSACTION_ID,
+ action,
+ iouType: CONST.IOU.TYPE.SUBMIT,
+ reportIDFromRoute: OPEN_REPORT_ID,
+ goBack: jest.fn(),
+ }),
+ {wrapper: Wrapper},
+ );
+}
+
+describe('useReportPickerActions', () => {
+ beforeAll(() => {
+ Onyx.init({keys: ONYXKEYS});
+ });
+
+ beforeEach(async () => {
+ await Onyx.clear();
+ await waitForBatchedUpdates();
+ });
+
+ it('creates the new report in the workspace the expense is created in, not in the default workspace', async () => {
+ // Given the user creates an expense from the chat of a non-default workspace that already has their open report
+ await givenOwnOpenReportInNonDefaultWorkspace();
+
+ // When the Report field opens the report picker
+ const {result} = renderReportPickerActions(CONST.IOU.ACTION.CREATE, buildTransaction(false));
+ await waitForBatchedUpdates();
+
+ // Then "Create report" targets that workspace, because the listed reports also come from it (issue #107683)
+ await waitFor(() => expect(result.current.listProps.transactionPolicyID).toBe(SELECTED_POLICY_ID));
+ expect(result.current.listProps.selectedPolicyID).toBe(SELECTED_POLICY_ID);
+ });
+
+ it('lets the default workspace apply when the expense is created from global create', async () => {
+ // Given the user starts the expense from global create, which doesn't tie it to a workspace
+ await givenOwnOpenReportInNonDefaultWorkspace();
+
+ // When the Report field opens the report picker
+ const {result} = renderReportPickerActions(CONST.IOU.ACTION.CREATE, buildTransaction(true));
+ await waitForBatchedUpdates();
+
+ // Then no workspace is forced, so "Create report" falls back to the default workspace
+ expect(result.current.listProps.transactionPolicyID).toBeUndefined();
+ });
+
+ it('lets the default workspace apply when the user moves their own expense', async () => {
+ // Given the user edits the report of their own existing expense
+ await givenOwnOpenReportInNonDefaultWorkspace();
+
+ // When the report picker opens for editing
+ const {result} = renderReportPickerActions(CONST.IOU.ACTION.EDIT, buildTransaction(false));
+ await waitForBatchedUpdates();
+
+ // Then no workspace is forced, so moving to a new report keeps using the default workspace
+ expect(result.current.listProps.transactionPolicyID).toBeUndefined();
+ });
+});
Created draft Preserve expense workspace when creating a report from workspace chat, assigned to ZhenjaHorbach, with your exact changes; all 20 targeted tests and static checks passed. Browser verification was blocked by a blank development app and suspended session after retry.
Step
Status
Open development web appThe page was blank; session state was unavailable.
❌
Verify workspace selection, Create report, global creation, and own-expense editingNot tested: the blank app prevented fixture setup and navigation.
BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2
Activity
applause-bot commentedon Nov 22, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/c17e224ea12389f0c4e8531a10537aff4d1e35e2e232feb46a251616af90c304
expensify-chore-bot commentedon Nov 22, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)[-]Reports - New report defaults to the default workspace instead of the selected workspace[/-][+][$175] Reports - New report defaults to the default workspace instead of the selected workspace[/+]expensify-chore-bot commentedon Nov 22, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022124410898921742791
MelvinBot commentedon Nov 22, 2026
🤖 Web test steps verification results: ❌ fail
Reproduced from non-default Workspace B’s chat composer + menu: the expense starts in B, but selecting Create report switches it to default Workspace A. No expense was submitted.

Navigate into Workspace B without changing the default
Workspace A remained the default; B’s expense chat contained two open report cards.Open + → Create expense → Manual
Used B’s chat composer menu, not the global sidebar button. The form initially showed Workspace B.Report picker preserves Workspace B context
Existing reports belonged to B, but Create report displayed Workspace A.Selecting Create report retains Workspace B
The form switched to Workspace A. Persisted report ownership was not independently verified.Proposal
What is the root cause of that problem?
The Report picker discards the expense’s workspace when the selected report belongs to the current user and the expense is not per diem. This causes Create report to fall back to the saved default workspace—even though the expense and existing-report options correctly identify the non-default workspace.
Code evidence and alternative explanations
undefinedas the target policy for an ordinary expense owned by the current user.The initial-context-loss hypothesis does not explain this reproduction: the manual form and existing-report options retained B until Create report was selected. The frontend fallback explains the observed switch without requiring a backend redirect.
Scope: Verified on development web through the chat composer. The global sidebar + entry point was not verified; it should not be conflated with this flow. No introducing PR was established.
What changes do you think we should make in order to solve the problem?
Preserve the explicit workspace-chat destination when creating a new report for a non-global expense. Do not discard it solely because the selected report belongs to the current user.
Keep global-create defaults, editing behavior, per-diem handling, other-owner handling, and workspace restrictions intact.
Regression coverage
With A default and B non-default, each containing two open reports:
What alternative solutions did you explore? (Optional)
Changing the saved default workspace would mask the bug rather than preserve the expense’s existing workspace context.
Related issue: Consolidate the default-workspace eligibility rule across report and expense flows concerns overlapping fallback logic, but is not a confirmed duplicate.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement thisto create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run · view recording
akzkid commentedon Nov 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When I create an expense from a non-default workspace and pick Create report in the Report field, the new report goes to my default workspace instead of the workspace I started the expense in.
What is the root cause of that problem?
The report picker decides where Create report goes with
usePolicyForMovingExpenses. It passestargetExpensePolicyIDas the preferred workspace:App/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts
Lines 196 to 210 in 5de42f6
targetExpensePolicyIDis only set when the expense belongs to another user or is per diem. For my own regular expense it is alwaysundefined, even when I'm creating the expense inside a specific workspace chat (transactionPolicyID, the workspace of the chat I started in, is already computed on L196 but not used here).With no
expensePolicyID,usePolicyForMovingExpensesfalls back to the active/default workspace:App/src/hooks/usePolicyForMovingExpenses.ts
Lines 127 to 143 in 5de42f6
So
policyForMovingExpensesis the default workspace, andcreateReportForPolicybuilds the optimistic report on that policy (App/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts
Lines 261 to 276 in 5de42f6
handleRegularReportSelectionmoves the draft expense onto that new report, so the expense also switches to the default workspace. The list already uses the chat's workspace when creating an expense (selectedPolicyID,App/src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts
Lines 311 to 316 in 5de42f6
The comment there says "fall back to undefined to let the default workspace apply". That makes sense when moving an existing expense, but not when the expense is being created from a chosen workspace chat.
What changes do you think we should make in order to solve the problem?
In
useReportPickerActions, when we're creating an expense (action === CREATE) and its participant is a workspace chat, pass that workspace (transactionPolicyID) tousePolicyForMovingExpensesas the preferred policy. Keep the current behavior for editing/moving existing expenses (still default workspace) and for other users' and per diem expenses.usePolicyForMovingExpensesalready checks that the preferred policy is valid (member, can create expenses, group policy, not pending delete, time tracking for time requests). If it isn't valid, it still falls back to the default workspace, so we don't add a new edge case.The empty-report confirmation and the restricted-action check already use
policyForMovingExpenses, so they follow the right workspace automatically.What specific scenarios should we test?
tests/ui/components/IOURequestStepReportNewReportTest.tsxcovering a non-default workspace chat.What alternative solutions did you explore? (Optional)
Using
reportOrDraftReport?.policyID(the same source asselectedPolicyID) as the preferred policy for the create flow, so the list and Create report always use the same workspace.Contributor details
Your Expensify account email: carp-digest@mail.grokbot.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01be5d412b545fdf18
melvin-bot commentedon Nov 22, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
danlopes18-ctrl commentedon Nov 22, 2026
Proposal
What is the root cause of that problem?
In
src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts(lines 196–210),targetExpensePolicyIDdetermines which workspace Create report targets (both for creating the report increateReportForPolicyat lines 261–279 and for displaying the workspace subtitle on the Create report row viatransactionPolicyID: targetExpensePolicyIDat line 328 →IOURequestEditReportCommon.tsx:169).Currently, line 201 only populates
targetExpensePolicyIDwhenownerAccountID !== session?.accountID || isPerDiemTransaction, otherwise setting it toundefined:selectedReportisundefined, soownerAccountIDisundefinedandownerAccountID !== session?.accountIDaccidentally evaluates totrue, preservingtransactionPolicyID.selectedReportresolves to an open report owned by the current user (ownerAccountID === session?.accountID), so line 201 flips tofalseand discards the originating workspace (targetExpensePolicyID = undefined).undefinedtousePolicyForMovingExpenses(src/hooks/usePolicyForMovingExpenses.ts:135–142) skips the preferredvalidExpensePolicyIDbranch and falls back toactivePolicy(the user's default workspace). Meanwhile,selectedPolicyIDat line 315 explicitly preservesreportOrDraftReport?.policyID ?? transactionPolicyIDwhen!isEditing && !isFromGlobalCreate, which is why the picker lists Workspace B's existing reports while Create report targets default Workspace A and moves the draft expense there.What changes do you think we should make in order to solve the problem?
In
src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts:targetExpensePolicyIDcondition at line 201 to also apply when creating a non-global expense (isCreateReport && !isFromGlobalCreate), resolvingselectedReport?.policyID ?? reportOrDraftReport?.policyID ?? transactionPolicyID(aligned withselectedPolicyIDat line 315 so both the existing-report list and Create report always use the same originating workspace, including whenreportIDFromRouteis a generated ID or a workspace chat/report).!isFromGlobalCreatein the guard so Global Create (+sidebar button, whereselectedPolicyIDis intentionallyundefinedto list reports across all workspaces and allow default/workspace-picker resolution viashouldSelectPolicy) is unaffected.isEditing, per-diem, time, managed-card, and other-owner flows untouched.targetExpensePolicyIDfeeds bothusePolicyForMovingExpenses(line 208) andlistProps.transactionPolicyID(line 328 →IOURequestEditReportCommon.tsx:169), both the Create report row subtitle, restriction check (createReport), empty-report confirmation, andcreateReportForPolicyautomatically target the originating non-default workspace across both the anchored dropdown and full-page report picker.tests/ui/components/IOURequestStepReportNewReportTest.tsx:activePolicyID) and Workspace B non-default (both containing open reports), open the Report picker while creating a manual expense in Workspace B's chat (isFromGlobalCreate: false) and assert that Create report displays and creates the new report on Workspace B (policyID: B) rather than Workspace A.isFromGlobalCreate: true) and editing an existing expense (action: EDIT) preserve their existing fallback behavior.What alternative solutions did you explore? (Optional)
transactionPolicyIDfor allaction === CREATEflows without checking!isFromGlobalCreate: Rejected because in Global Create (isFromGlobalCreate: true),selectedPolicyIDis intentionallyundefinedso the picker spans all workspaces andCreate reportrespects the default workspace /shouldSelectPolicyworkspace selector flow.selectedPolicyIDdirectly intousePolicyForMovingExpenses: Rejected because for editing another user's expense (isEditing === trueandownerAccountID !== session?.accountID),selectedPolicyIDisundefined, whereastargetExpensePolicyIDmust still preserveselectedReport?.policyID ?? transactionPolicyID.TassioSales commentedon Nov 22, 2026
Contributor details:
Your Expensify account email: tassiolucian.ljs@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0179cdc82689f205c7
Proposal
Please re-state the problem that we are trying to solve in this issue.
When initiating expense creation from a non-default workspace (Workspace B) with existing open reports and tapping on the Report field, selecting Create report creates the new report in the default workspace (Workspace A) instead of retaining the selected originating workspace (Workspace B).
What is the root cause of that problem?
In
src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts(lines 196–210 & 315–328):targetExpensePolicyID:For a user's own manual expense in a non-default workspace with open reports,
selectedReportresolves to the user's existing open report (ownerAccountID === session?.accountID), soownerAccountID !== session?.accountIDisfalse. Consequently,targetExpensePolicyIDis set toundefined.targetExpensePolicyIDis passed intousePolicyForMovingExpenses(line 208) andlistProps.transactionPolicyID(line 328):When
targetExpensePolicyIDisundefined,usePolicyForMovingExpensesfalls back toactivePolicy(the user's saved default workspace, Workspace A).What changes do you think we should make in order to solve the problem?
In
src/pages/iou/request/step/IOURequestStepReport/hooks/useReportPickerActions.ts:Update
targetExpensePolicyID(line 201) to preserve the originating policy during non-global expense creation (!isFromGlobalCreate && !isEditing/isCreateReport):This guarantees that:
isFromGlobalCreate === true, via+in global LHN) continues to passundefined, allowing standard default workspace resolution (shouldSelectPolicy).usePolicyForMovingExpensesandlistProps.transactionPolicyIDreceive the consistent originatingpolicyID.What alternative solutions did you explore? (Optional)
targetExpensePolicyID = originatingPolicyID: Suboptimal because global create (isFromGlobalCreate) intentionally needsundefinedto allow workspace selection. Checking!isFromGlobalCreateensures global create flows remain intact.mountiny commentedon Nov 23, 2026
@ZhenjaHorbach can you take a look into this as its linked to your pr?
ZhenjaHorbach commentedon Nov 23, 2026
I will check!
oqildev commentedon Nov 23, 2026
@ZhenjaHorbach I reproduced this on web (video below) and with a unit test on
main, and MelvinBot's root cause is right. The owner check comes from #87962, not #106464, and it never looks ataction.If the fix only checks
action === CREATE, submitting a tracked expense to a workspace still goes to the default one. Using the same condition asselectedPolicyID(!isEditing && !isFromGlobalCreate) fixes both cases. Global create and editing keep the default workspace, and 362/362 related tests pass.107683-repro-web.webm
ZhenjaHorbach commentedon Nov 23, 2026
Yes
This issue can also be reproduced in prod
ZhenjaHorbach commentedon Nov 25, 2026
@MelvinBot
Create a PR with these changes
MelvinBot commentedon Nov 25, 2026
🤖 Web test steps verification results: ❌ fail
Created draft Preserve expense workspace when creating a report from workspace chat, assigned to

ZhenjaHorbach, with your exact changes; all 20 targeted tests and static checks passed. Browser verification was blocked by a blank development app and suspended session after retry.Open development web app
The page was blank; session state was unavailable.Verify workspace selection, Create report, global creation, and own-expense editing
Not tested: the blank app prevented fixture setup and navigation.view run · no recording available
expensify-chore-bot commentedon Dec 1, 2026
Triggered auto assignment to @Gonals, see https://stackoverflow.com/c/expensify/questions/7972 for more details.