Skip to content

Commit 38a764d

Browse files
committed
Don't pre-insert draft-only reports under the confirmation RHP
A draft-only report (the expense chat of a freshly created draft workspace) can't render as a report screen, so pre-inserting it stranded users on an infinite skeleton when backing out of "Submit to my employer" before submitting. Skip the REPORT_DRAFT fallback in the pre-insert readiness check. Fixes Expensify#96117.
1 parent a0d0a1d commit 38a764d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/pages/iou/request/step/IOURequestStepConfirmation.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,13 @@ function IOURequestStepConfirmation({
559559
// Don't pre-insert if the report is already showing - it would push a duplicate route.
560560
const hasValidDestination = !!destinationReportID && Navigation.getTopmostReportId() !== destinationReportID;
561561

562-
// The report must be in Onyx so the pre-inserted screen can render immediately.
563-
const isDestinationReportLoaded = !!destinationReportID && !!getReportOrDraftReport(destinationReportID, undefined, undefined, undefined, destinationReport)?.reportID;
562+
// The report must be in the REPORT collection so the pre-inserted screen can render immediately. A draft-only
563+
// report (e.g. the expense chat of a freshly created draft workspace in the zero-workspace "Submit to my
564+
// employer" flow) can't render — the report screen only reads COLLECTION.REPORT — so pre-inserting one would
565+
// strand the user on an infinite skeleton if they back out before submitting. Passing an empty draft to
566+
// getReportOrDraftReport skips its REPORT_DRAFT fallback while keeping the module-cache fallback for
567+
// real reports that useOnyx hasn't hydrated yet.
568+
const isDestinationReportLoaded = !!destinationReportID && !!getReportOrDraftReport(destinationReportID, undefined, undefined, {}, destinationReport)?.reportID;
564569

565570
const shouldPreInsertReport = canUseReportPreInsert && isOutsideRHP && hasValidDestination && isDestinationReportLoaded;
566571

0 commit comments

Comments
 (0)