Repository navigation
Conversation
…n employer with no workspace Submit to my employer used to create a local draft workspace, which made every workspace page reached from the confirmation flow (e.g. adding a category) show Not here, because those pages only read real policies. Create the workspace with createWorkspace up front instead, and remove the draft-only submit path that created the workspace inside AddTrackedExpenseToPolicy. Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
|
I created this PR from an upstream branch because I don't have push access to your fork. To take ownership of this branch and push updates, run: Then you can close this PR and open a new one from your fork. |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
The failing check is unrelated to this PR, so I didn't push a code change. Analysis: Evidence: The same suite fails today on unrelated PRs with similar fractional differences, and some of those branches pass on a rerun:
Next step: Rerun the whole "Reassure Performance Tests" workflow (not only the failed job, so measurements regenerate). |
|
🤖 Android test steps verification results: ❌ fail On a no-workspace account, the self-DM expense was created and "Submit to my employer" was offered, but selecting it from the expense's header "More" menu froze the app, so I couldn't reach the category picker or submit the expense. The PR's Tests section is still a TODO, so I used the reproduction steps from the linked issue.
|
|
@MelvinBot resolve conflicts |
|
🤖 Web test steps verification results: ❌ fail Resolved the conflicts locally, but did not commit or push because validation is blocked by
view run · no recording available |
|
@MelvinBot resolve conflicts |
|
🤖 Web test steps verification results: ❌ fail Conflicts were resolved locally, but not committed or pushed: validation remains blocked by Bun initialization and Jest module-loading errors; Storybook smoke tests passed. Browser verification was blocked by a blank page.
view run · no recording available |
|
@MelvinBot resolve conflicts |
|
🤖 Web test steps verification results: ❌ fail Conflicts were resolved locally, but not committed or pushed: lint/typecheck remain blocked by Bun initialization, and Jest hits ES-module loading errors. Storybook smoke tests and 18 submission-routing tests passed; web verification was blocked by an empty page.
view run · no recording available |
|
@MelvinBot resolve conflicts |
|
Conflicts were resolved locally, but not committed or pushed because validation was blocked:
The PR remains unchanged. The development environment needs repair before the resolution can be validated and pushed. |











Explanation of Change
When a user with no workspace chose Submit to my employer, the App only created a local draft workspace (
POLICY_DRAFTS). The server created the real workspace later, insideAddTrackedExpenseToPolicy, when the expense was submitted. Workspace pages opened from the confirmation flow only read real policies, so tapping + on the category picker opened the add-category screen, and itsAccessOrNotFoundWrapperfound no policy and showed Not here.As agreed on the issue, this PR creates a real Submit workspace with
createWorkspaceas soon as the user taps Submit to my employer:StartExpenseFlows.ts: the no-workspace branch now callscreateWorkspacewith the same optionsuseAutoCreateSubmitWorkspaceuses (type: SUBMIT,engagementChoice: EMPLOYER,makeMeAdmin, no onboarding tasks, no guide welcome message). It points the draft transaction at the new expense chat and opens confirmation with the samebackTobehavior as before. A module-level guard keeps a fast double tap from creating two workspaces.ChatActionableButtons,ReportDetailsMenuTrackExpenseItems,MoneyRequestHeaderSecondaryActions) pass the extra valuescreateWorkspaceneeds (conciergeChat,isSelfTourViewed,hasActiveAdminPolicies,delegateAccountID,hasOwnedPaidPolicy).requestMoney, thenAddTrackedExpenseToPolicy), so the draft-only submit path is removed:isSubmittingExpenseToDraftWorkspace(inuseExpenseSubmission,useTrackExpenseSubmissionandresolveSubmissionPath)SUBMITcase intrackExpenseandsubmitTrackedExpenseToPolicy.moveTrackedExpenseToPolicyis folded back intocategorizeTrackedExpense, its only remaining caller.policyTypeoption inTrackExpense.ts,isDistanceRequestinTrackedExpenseParams, andpolicyName/typeinAddTrackedExpenseToPolicyParamstypeoption and Submit branches increateDraftWorkspacePOLICY_DRAFTSand the shared draft code are unchanged, apart from comments that no longer mention Submit.AI tests run locally:
npm run typecheck,npm run lint-changed,npm run spell-changedandreact-compiler-compliance-check checkon the changed components all passed. Formatting was applied withnpm run fmt.CreateDraftTransactionTest,resolveSubmissionPathTest,TrackExpenseTest,RequestMoneyTest,PolicyTest,ChatActionableButtonsTest,MoneyRequestHeaderSecondaryActionsTest,useExpenseSubmission.testandSubmitTrackedExpenseGoBackTests.POLICY(notPOLICY_DRAFTS), and a double tap creates only one workspace.npm run linton the whole repo, and the Storybook smoke test.Fixed Issues
$ #101766
PROPOSAL: #101766 (comment)
Tests
// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.
Offline tests
QA Steps
// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari