@@ -3,6 +3,7 @@ import {useEffect, useEffectEvent, useRef} from 'react';
33import type { OnyxEntry } from 'react-native-onyx' ;
44import { useCurrentReportIDState } from '@hooks/useCurrentReportID' ;
55import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
6+ import useIsOwnWorkspaceChatRef from '@hooks/useIsOwnWorkspaceChatRef' ;
67import useOnyx from '@hooks/useOnyx' ;
78import useParentReportAction from '@hooks/useParentReportAction' ;
89import usePrevious from '@hooks/usePrevious' ;
@@ -81,6 +82,11 @@ function ReportNavigateAwayHandler() {
8182 const isOptimisticDelete = report ?. statusNum === CONST . REPORT . STATUS_NUM . CLOSED ;
8283 const { wasDeleted : reportWasDeleted , parentReportID : deletedReportParentID } = useReportWasDeleted ( reportIDFromRoute , report , isOptimisticDelete , userLeavingStatus ) ;
8384
85+ // Track whether the current route is an own workspace chat. A vacation delegate split sends
86+ // a temporary Onyx SET that wipes the report; by the time effects fire, report is undefined
87+ // so we must persist the value in a ref updated synchronously during render. See issue #84248.
88+ const isCurrentRouteOwnWorkspaceChatRef = useIsOwnWorkspaceChatRef ( report , reportIDFromRoute ) ;
89+
8490 const firstRender = useRef ( true ) ;
8591
8692 // Navigation action that reads non-reactive context (concierge params, modal state, etc.)
@@ -138,7 +144,10 @@ function ReportNavigateAwayHandler() {
138144 isEmpty ( report ) &&
139145 ( isMoneyRequest ( prevReport ) ||
140146 isMoneyRequestReport ( prevReport ) ||
141- isPolicyExpenseChat ( prevReport ) ||
147+ // Own workspace chats are excluded: a vacation delegate split sends a temporary
148+ // Onyx SET that wipes the report — the chat was never intentionally removed.
149+ // See issue #84248.
150+ ( isPolicyExpenseChat ( prevReport ) && ! prevReport ?. isOwnPolicyExpenseChat ) ||
142151 isGroupChat ( prevReport ) ||
143152 isAdminRoom ( prevReport ) ||
144153 isAnnounceRoom ( prevReport ) ) ;
@@ -194,6 +203,17 @@ function ReportNavigateAwayHandler() {
194203 return ;
195204 }
196205
206+ // For own workspace chats, a vacation delegate split sends a temporary Onyx SET that
207+ // silently wipes the report from Onyx — triggering this effect. We skip navigation here
208+ // entirely: the re-fetch effect in ReportFetchHandler restores the data, which causes
209+ // useReportWasDeleted to reset wasDeleted → false, and this effect exits early on the
210+ // next run. Genuine workspace deletions (e.g. user removed, workspace closed) always
211+ // trigger the "navigate on removal" effect above via userLeavingStatus / didReportClose,
212+ // never via this path alone. See issue #84248.
213+ if ( isCurrentRouteOwnWorkspaceChatRef . current ) {
214+ return ;
215+ }
216+
197217 // Try to navigate to parent report if available
198218 if ( deletedReportParentID && ! isMoneyRequestReportPendingDeletion ( deletedReportParentID ) ) {
199219 Navigation . isNavigationReady ( ) . then ( ( ) => {
0 commit comments