Fix Create Report row showing wrong workspace name when moving expenses#85927
Fix Create Report row showing wrong workspace name when moving expenses#85927
Conversation
…expenses The "Create report" row in the move-to-report flow was displaying the source workspace name instead of the default workspace name. This happened because IOURequestEditReportCommon independently derived the display policy from selectedReport?.policyID, overriding the caller's intent. Now each caller explicitly passes the policyID they want displayed via the transactionPolicyID prop, and the common component no longer falls back to selectedReport?.policyID. Co-authored-by: Jayesh Mangwani <jayeshmangwani@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
The failing check Analysis: The Android build fails with: This is a build infrastructure issue with the expo autolinking gradle script not being present in Evidence: This PR only modifies 3 TypeScript UI files:
None of these files affect the Android build system, Gradle configuration, or expo autolinking. This appears to be a pre-existing or transient build environment issue. |
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 checks are unrelated to this PR's changes. Analysis:
These builds should pass on a re-run or once the underlying infrastructure issue is resolved. |
|
@MelvinBot, looks like these changes caused a bug. Moving reports are being created in the same workspace instead of the Default workspace. |
The previous fix only updated the display in IOURequestEditReportCommon to show the default workspace, but IOURequestEditReport still passed selectedReport?.policyID to its own usePolicyForMovingExpenses call, causing reports to be created in the source workspace instead of the default workspace. Passing undefined lets the hook fall back to the user's default workspace for both display and creation. Co-authored-by: Jayesh Mangwani <jayeshmangwani@users.noreply.github.com>
|
Good catch! The original fix only updated the display in Root Cause:
Fix pushed: Changed the |
|
The failing check ( Analysis: The Android build failed with: This is a build environment/dependency issue — the Evidence: The same Android build workflow ( |
|
The failing build checks are unrelated to this PR's changes. Failing checks:
Evidence:
|
|
@MelvinBot merge latest main. |
…tWorkspaceDisplay Co-authored-by: Jayesh Mangwani <jayeshmangwani@users.noreply.github.com>
|
Done — merged latest |
|
The failing check Analysis: This PR only modifies 4 TypeScript files ( Evidence: The same |
Explanation of Change
The "Create report" row in the move-to-report flow (
IOURequestEditReport) was displaying the source workspace name instead of the default workspace name. This happened becauseIOURequestEditReportCommonindependently derived the display policy fromselectedReport?.policyID, overriding what the caller intended.The fix moves the responsibility of deciding which
policyIDto display to each caller via thetransactionPolicyIDprop:IOURequestEditReportCommon.tsx: Removed theselectedReport?.policyIDfallback from theusePolicyForMovingExpensescall — now uses only the caller-providedtransactionPolicyID.IOURequestStepReport.tsx: Updated to explicitly passselectedReport?.policyID ?? transactionPolicyID, preserving existing behavior.SearchTransactionsChangeReport.tsx: AddedtransactionPolicyID={selectedReportPolicyID}prop, preserving existing behavior.When
IOURequestEditReportdoes not passtransactionPolicyID, the hook receivesundefinedand returns the user's default workspace — matching the actual report creation behavior.Fixed Issues
$ #84618
PROPOSAL: #84618 (comment)
Tests
Offline tests
N/A — This change only affects which workspace name is displayed in the UI. The underlying data flow does not change.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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