diff --git a/src/libs/actions/App.ts b/src/libs/actions/App.ts index cd92d3ce8531..3416f7783ab2 100644 --- a/src/libs/actions/App.ts +++ b/src/libs/actions/App.ts @@ -17,8 +17,8 @@ import {isPublicRoom, isValidReport} from '@libs/ReportUtils'; import {isLoggingInAsNewUser as isLoggingInAsNewUserSessionUtils} from '@libs/SessionUtils'; import {clearSoundAssetsCache} from '@libs/Sound'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; import type {OnyxKey} from '@src/ONYXKEYS'; +import ONYXKEYS from '@src/ONYXKEYS'; import type {Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; @@ -87,8 +87,11 @@ Onyx.connectWithoutView({ }, }); +// allReports is used in the "ForOpenOrReconnect" functions and is not directly associated with the View, +// so retrieving it using Onyx.connectWithoutView is correct. +// If this variable is ever needed for use in React components, it should be retrieved using useOnyx. let allReports: OnyxCollection; -Onyx.connect({ +Onyx.connectWithoutView({ key: ONYXKEYS.COLLECTION.REPORT, waitForCollectionCallback: true, callback: (value) => {