Skip to content

Commit 209f7a3

Browse files
committed
Remove Onyx.connect
1 parent 79f43d2 commit 209f7a3

2 files changed

Lines changed: 5 additions & 23 deletions

File tree

src/Expensify.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ function Expensify() {
101101
const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED, {canBeMissing: true});
102102
const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST, {canBeMissing: true});
103103
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: true});
104+
const [currentOnboardingPurposeSelected] = useOnyx(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED, {canBeMissing: true});
105+
const [currentOnboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE, {canBeMissing: true});
104106

105107
useDebugShortcut();
106108

@@ -204,12 +206,12 @@ function Expensify() {
204206
// If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report
205207
Linking.getInitialURL().then((url) => {
206208
setInitialUrl(url as Route);
207-
Report.openReportFromDeepLink(url ?? '');
209+
Report.openReportFromDeepLink(url ?? '', currentOnboardingPurposeSelected, currentOnboardingCompanySize);
208210
});
209211

210212
// Open chat report from a deep link (only mobile native)
211213
Linking.addEventListener('url', (state) => {
212-
Report.openReportFromDeepLink(state.url);
214+
Report.openReportFromDeepLink(state.url, currentOnboardingPurposeSelected, currentOnboardingCompanySize);
213215
});
214216
if (CONFIG.IS_HYBRID_APP) {
215217
HybridAppModule.onURLListenerAdded();

src/libs/actions/Report.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -361,26 +361,6 @@ Onyx.connect({
361361
},
362362
});
363363

364-
// This value is used inside openReportFromDeepLink function, which triggered inside setup/hybridApp -> Linking.addEventListener method
365-
let currentOnboardingPurposeSelected: OnyxEntry<OnboardingPurpose>;
366-
// eslint-disable-next-line rulesdir/no-onyx-connect
367-
Onyx.connect({
368-
key: ONYXKEYS.ONBOARDING_PURPOSE_SELECTED,
369-
callback: (value) => {
370-
currentOnboardingPurposeSelected = value;
371-
},
372-
});
373-
374-
// This value is used inside openReportFromDeepLink function, which triggered inside setup/hybridApp -> Linking.addEventListener method
375-
let currentOnboardingCompanySize: OnyxEntry<OnboardingCompanySize>;
376-
// eslint-disable-next-line rulesdir/no-onyx-connect
377-
Onyx.connect({
378-
key: ONYXKEYS.ONBOARDING_COMPANY_SIZE,
379-
callback: (value) => {
380-
currentOnboardingCompanySize = value;
381-
},
382-
});
383-
384364
let onboardingInitialPath: OnyxEntry<string>;
385365
Onyx.connect({
386366
key: ONYXKEYS.ONBOARDING_LAST_VISITED_PATH,
@@ -3389,7 +3369,7 @@ function doneCheckingPublicRoom() {
33893369
Onyx.set(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, false);
33903370
}
33913371

3392-
function openReportFromDeepLink(url: string) {
3372+
function openReportFromDeepLink(url: string, currentOnboardingPurposeSelected: OnyxEntry<OnboardingPurpose>, currentOnboardingCompanySize: OnyxEntry<OnboardingCompanySize>) {
33933373
const reportID = getReportIDFromLink(url);
33943374
const isAuthenticated = hasAuthToken();
33953375

0 commit comments

Comments
 (0)