@@ -137,8 +137,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
137137 const { translate} = useLocalize ( ) ;
138138 const reportIDFromRoute = getNonEmptyStringOnyxID ( route . params ?. reportID ) ;
139139 const reportActionIDFromRoute = route ?. params ?. reportActionID ;
140- const parentReportIDFromRoute = route ?. params ?. parentReportID ;
141- const parentReportActionIDFromRoute = route ?. params ?. parentReportActionID ;
142140 const isFocused = useIsFocused ( ) ;
143141 const prevIsFocused = usePrevious ( isFocused ) ;
144142 const firstRenderRef = useRef ( true ) ;
@@ -159,9 +157,9 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
159157 const [ reportNameValuePairsOnyx ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_NAME_VALUE_PAIRS } ${ reportIDFromRoute } ` , { allowStaleData : true , canBeMissing : true } ) ;
160158 const [ reportMetadata = defaultReportMetadata ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_METADATA } ${ reportIDFromRoute } ` , { canBeMissing : true , allowStaleData : true } ) ;
161159 const [ policies = getEmptyObject < NonNullable < OnyxCollection < OnyxTypes . Policy > > > ( ) ] = useOnyx ( ONYXKEYS . COLLECTION . POLICY , { allowStaleData : true , canBeMissing : false } ) ;
162- const [ parentReportAction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ getNonEmptyStringOnyxID ( reportOnyx ?. parentReportID ?? parentReportIDFromRoute ) } ` , {
160+ const [ parentReportAction ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ getNonEmptyStringOnyxID ( reportOnyx ?. parentReportID ) } ` , {
163161 canEvict : false ,
164- selector : ( parentReportActions ) => getParentReportAction ( parentReportActions , reportOnyx ?. parentReportActionID ?? parentReportActionIDFromRoute ) ,
162+ selector : ( parentReportActions ) => getParentReportAction ( parentReportActions , reportOnyx ?. parentReportActionID ) ,
165163 canBeMissing : true ,
166164 } ) ;
167165 const deletedParentAction = isDeletedParentAction ( parentReportAction ) ;
@@ -207,8 +205,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
207205 return '' ;
208206 } , [ accountManagerReportID , accountManagerReport , personalDetails , translate ] ) ;
209207
210- const [ parentReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ parentReportIDFromRoute } ` , { canBeMissing : true } ) ;
211-
212208 /**
213209 * Create a lightweight Report so as to keep the re-rendering as light as possible by
214210 * passing in only the required props.
@@ -219,58 +215,48 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
219215 */
220216 const report = useMemo (
221217 ( ) =>
222- // This is required to get the transaction data from the parent report, to render the optimistic transaction thread
223- parentReportIDFromRoute && parentReportActionIDFromRoute
224- ? ( {
225- ...reportOnyx ,
226- reportID : reportIDFromRoute ,
227- parentReportID : parentReportIDFromRoute ,
228- parentReportActionID : parentReportActionIDFromRoute ,
229- policyID : parentReport ?. policyID ,
230- type : CONST . REPORT . TYPE . CHAT ,
231- } as OnyxTypes . Report )
232- : reportOnyx && {
233- lastReadTime : reportOnyx . lastReadTime ,
234- reportID : reportOnyx . reportID ,
235- policyID : reportOnyx . policyID ,
236- lastVisibleActionCreated : reportOnyx . lastVisibleActionCreated ,
237- statusNum : reportOnyx . statusNum ,
238- stateNum : reportOnyx . stateNum ,
239- writeCapability : reportOnyx . writeCapability ,
240- type : reportOnyx . type ,
241- errorFields : reportOnyx . errorFields ,
242- parentReportID : reportOnyx . parentReportID ,
243- parentReportActionID : reportOnyx . parentReportActionID ,
244- chatType : reportOnyx . chatType ,
245- pendingFields : reportOnyx . pendingFields ,
246- isDeletedParentAction : reportOnyx . isDeletedParentAction ,
247- reportName : reportOnyx . reportName ,
248- description : reportOnyx . description ,
249- managerID : reportOnyx . managerID ,
250- total : reportOnyx . total ,
251- nonReimbursableTotal : reportOnyx . nonReimbursableTotal ,
252- fieldList : reportOnyx . fieldList ,
253- ownerAccountID : reportOnyx . ownerAccountID ,
254- currency : reportOnyx . currency ,
255- unheldTotal : reportOnyx . unheldTotal ,
256- unheldNonReimbursableTotal : reportOnyx . unheldNonReimbursableTotal ,
257- participants : reportOnyx . participants ,
258- isWaitingOnBankAccount : reportOnyx . isWaitingOnBankAccount ,
259- iouReportID : reportOnyx . iouReportID ,
260- isOwnPolicyExpenseChat : reportOnyx . isOwnPolicyExpenseChat ,
261- isPinned : reportOnyx . isPinned ,
262- chatReportID : reportOnyx . chatReportID ,
263- visibility : reportOnyx . visibility ,
264- oldPolicyName : reportOnyx . oldPolicyName ,
265- policyName : reportOnyx . policyName ,
266- private_isArchived : reportNameValuePairsOnyx ?. private_isArchived ,
267- lastMentionedTime : reportOnyx . lastMentionedTime ,
268- avatarUrl : reportOnyx . avatarUrl ,
269- permissions,
270- invoiceReceiver : reportOnyx . invoiceReceiver ,
271- policyAvatar : reportOnyx . policyAvatar ,
272- } ,
273- [ parentReportIDFromRoute , parentReportActionIDFromRoute , reportOnyx , reportIDFromRoute , parentReport ?. policyID , reportNameValuePairsOnyx ?. private_isArchived , permissions ] ,
218+ reportOnyx && {
219+ lastReadTime : reportOnyx . lastReadTime ,
220+ reportID : reportOnyx . reportID ,
221+ policyID : reportOnyx . policyID ,
222+ lastVisibleActionCreated : reportOnyx . lastVisibleActionCreated ,
223+ statusNum : reportOnyx . statusNum ,
224+ stateNum : reportOnyx . stateNum ,
225+ writeCapability : reportOnyx . writeCapability ,
226+ type : reportOnyx . type ,
227+ errorFields : reportOnyx . errorFields ,
228+ parentReportID : reportOnyx . parentReportID ,
229+ parentReportActionID : reportOnyx . parentReportActionID ,
230+ chatType : reportOnyx . chatType ,
231+ pendingFields : reportOnyx . pendingFields ,
232+ isDeletedParentAction : reportOnyx . isDeletedParentAction ,
233+ reportName : reportOnyx . reportName ,
234+ description : reportOnyx . description ,
235+ managerID : reportOnyx . managerID ,
236+ total : reportOnyx . total ,
237+ nonReimbursableTotal : reportOnyx . nonReimbursableTotal ,
238+ fieldList : reportOnyx . fieldList ,
239+ ownerAccountID : reportOnyx . ownerAccountID ,
240+ currency : reportOnyx . currency ,
241+ unheldTotal : reportOnyx . unheldTotal ,
242+ unheldNonReimbursableTotal : reportOnyx . unheldNonReimbursableTotal ,
243+ participants : reportOnyx . participants ,
244+ isWaitingOnBankAccount : reportOnyx . isWaitingOnBankAccount ,
245+ iouReportID : reportOnyx . iouReportID ,
246+ isOwnPolicyExpenseChat : reportOnyx . isOwnPolicyExpenseChat ,
247+ isPinned : reportOnyx . isPinned ,
248+ chatReportID : reportOnyx . chatReportID ,
249+ visibility : reportOnyx . visibility ,
250+ oldPolicyName : reportOnyx . oldPolicyName ,
251+ policyName : reportOnyx . policyName ,
252+ private_isArchived : reportNameValuePairsOnyx ?. private_isArchived ,
253+ lastMentionedTime : reportOnyx . lastMentionedTime ,
254+ avatarUrl : reportOnyx . avatarUrl ,
255+ permissions,
256+ invoiceReceiver : reportOnyx . invoiceReceiver ,
257+ policyAvatar : reportOnyx . policyAvatar ,
258+ } ,
259+ [ reportOnyx , reportNameValuePairsOnyx , permissions ] ,
274260 ) ;
275261 const reportID = report ?. reportID ;
276262
@@ -322,7 +308,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
322308 } ) ;
323309 const combinedReportActions = getCombinedReportActions ( reportActions , transactionThreadReportID ?? null , Object . values ( transactionThreadReportActions ) ) ;
324310 const lastReportAction = [ ...combinedReportActions , parentReportAction ] . find ( ( action ) => canEditReportAction ( action ) && ! isMoneyRequestAction ( action ) ) ;
325- const policy = policies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID ?? parentReport ?. policyID } ` ] ;
311+ const policy = policies ?. [ `${ ONYXKEYS . COLLECTION . POLICY } ${ report ?. policyID } ` ] ;
326312 const isTopMostReportId = currentReportIDValue ?. currentReportID === reportIDFromRoute ;
327313 const didSubscribeToReportLeavingEvents = useRef ( false ) ;
328314 const isTransactionThreadView = isReportTransactionThread ( report ) ;
@@ -384,7 +370,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
384370 < MoneyRequestHeader
385371 report = { report }
386372 policy = { policy }
387- backTo = { backTo }
388373 parentReportAction = { parentReportAction }
389374 onBackButtonPress = { onBackButtonPress }
390375 />
@@ -832,12 +817,11 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
832817 < ReportActionsView
833818 report = { report }
834819 reportActions = { reportActions }
835- isLoadingInitialReportActions = { reportMetadata ?. isLoadingInitialReportActions && ! isTransactionThreadView }
820+ isLoadingInitialReportActions = { reportMetadata ?. isLoadingInitialReportActions }
836821 hasNewerActions = { hasNewerActions }
837822 hasOlderActions = { hasOlderActions }
838823 parentReportAction = { parentReportAction }
839824 transactionThreadReportID = { transactionThreadReportID }
840- isReportTransactionThread = { isTransactionThreadView }
841825 />
842826 ) : null }
843827 { ! ! report && shouldDisplayMoneyRequestActionsList && ! shouldWaitForTransactions ? (
0 commit comments