Skip to content

Commit 52bdae8

Browse files
committed
add comment
1 parent a4b64b7 commit 52bdae8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/libs/actions/replaceOptimisticReportWithActualReport.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {DeviceEventEmitter, InteractionManager} from 'react-native';
22
import type {OnyxCollection} from 'react-native-onyx';
33
import Onyx from 'react-native-onyx';
4-
import {saveReportDraftComment} from '@libs/actions/Report';
54
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';
65
import {isMoneyRequest, isMoneyRequestReport} from '@libs/ReportUtils';
76
import ONYXKEYS from '@src/ONYXKEYS';
87
import type {Route} from '@src/ROUTES';
98
import SCREENS from '@src/SCREENS';
109
import 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

3434
let allReportDraftComments: Record<string, string | undefined> = {};
35+
// Draft comments are cached only for transferring to the preexisting report; no UI subscribes, so connectWithoutView() is used.
3536
Onyx.connectWithoutView({
3637
key: ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT,
3738
waitForCollectionCallback: true,
@@ -41,6 +42,7 @@ Onyx.connectWithoutView({
4142
let allReports: OnyxCollection<Report>;
4243

4344
const allReportActions: OnyxCollection<ReportActions> = {};
45+
// Report actions are cached only to resolve parent actions for IOU cleanup; no UI subscribes, so connectWithoutView() is used.
4446
Onyx.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.
147150
Onyx.connectWithoutView({
148151
key: ONYXKEYS.COLLECTION.REPORT,
149152
waitForCollectionCallback: true,

0 commit comments

Comments
 (0)