11import { DeviceEventEmitter , InteractionManager } from 'react-native' ;
22import type { OnyxCollection } from 'react-native-onyx' ;
33import Onyx from 'react-native-onyx' ;
4- import { saveReportDraftComment } from '@libs/actions/Report' ;
54import Navigation , { navigationRef } from '@libs/Navigation/Navigation' ;
65import { isMoneyRequest , isMoneyRequestReport } from '@libs/ReportUtils' ;
76import ONYXKEYS from '@src/ONYXKEYS' ;
87import type { Route } from '@src/ROUTES' ;
98import SCREENS from '@src/SCREENS' ;
109import type { Report , ReportActions } from '@src/types/onyx' ;
10+ import { saveReportDraftComment } from './Report' ;
1111
1212/**
1313 * replaceOptimisticReportWithActualReport
@@ -32,6 +32,7 @@ import type {Report, ReportActions} from '@src/types/onyx';
3232 */
3333
3434let allReportDraftComments : Record < string , string | undefined > = { } ;
35+ // Draft comments are cached only for transferring to the preexisting report; no UI subscribes, so connectWithoutView() is used.
3536Onyx . connectWithoutView ( {
3637 key : ONYXKEYS . COLLECTION . REPORT_DRAFT_COMMENT ,
3738 waitForCollectionCallback : true ,
@@ -41,6 +42,7 @@ Onyx.connectWithoutView({
4142let allReports : OnyxCollection < Report > ;
4243
4344const allReportActions : OnyxCollection < ReportActions > = { } ;
45+ // Report actions are cached only to resolve parent actions for IOU cleanup; no UI subscribes, so connectWithoutView() is used.
4446Onyx . connectWithoutView ( {
4547 key : ONYXKEYS . COLLECTION . REPORT_ACTIONS ,
4648 callback : ( actions , key ) => {
@@ -144,6 +146,7 @@ function replaceOptimisticReportWithActualReport(report: Report, draftReportComm
144146 } ) ;
145147}
146148
149+ // Reports are observed only to detect preexistingReportID and run replacement; no UI subscribes, so connectWithoutView() is used.
147150Onyx . connectWithoutView ( {
148151 key : ONYXKEYS . COLLECTION . REPORT ,
149152 waitForCollectionCallback : true ,
0 commit comments