Skip to content

Commit 3582506

Browse files
committed
Remove Onyx.connect for onboardingInitialPath
1 parent 209f7a3 commit 3582506

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/Expensify.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function Expensify() {
103103
const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: true});
104104
const [currentOnboardingPurposeSelected] = useOnyx(ONYXKEYS.ONBOARDING_PURPOSE_SELECTED, {canBeMissing: true});
105105
const [currentOnboardingCompanySize] = useOnyx(ONYXKEYS.ONBOARDING_COMPANY_SIZE, {canBeMissing: true});
106+
const [onboardingInitialPath] = useOnyx(ONYXKEYS.ONBOARDING_LAST_VISITED_PATH, {canBeMissing: true});
106107

107108
useDebugShortcut();
108109

@@ -206,12 +207,12 @@ function Expensify() {
206207
// If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report
207208
Linking.getInitialURL().then((url) => {
208209
setInitialUrl(url as Route);
209-
Report.openReportFromDeepLink(url ?? '', currentOnboardingPurposeSelected, currentOnboardingCompanySize);
210+
Report.openReportFromDeepLink(url ?? '', currentOnboardingPurposeSelected, currentOnboardingCompanySize, onboardingInitialPath);
210211
});
211212

212213
// Open chat report from a deep link (only mobile native)
213214
Linking.addEventListener('url', (state) => {
214-
Report.openReportFromDeepLink(state.url, currentOnboardingPurposeSelected, currentOnboardingCompanySize);
215+
Report.openReportFromDeepLink(state.url, currentOnboardingPurposeSelected, currentOnboardingCompanySize, onboardingInitialPath);
215216
});
216217
if (CONFIG.IS_HYBRID_APP) {
217218
HybridAppModule.onURLListenerAdded();

src/libs/actions/Report.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,6 @@ Onyx.connect({
361361
},
362362
});
363363

364-
let onboardingInitialPath: OnyxEntry<string>;
365-
Onyx.connect({
366-
key: ONYXKEYS.ONBOARDING_LAST_VISITED_PATH,
367-
callback: (value) => {
368-
onboardingInitialPath = value;
369-
},
370-
});
371-
372364
const typingWatchTimers: Record<string, NodeJS.Timeout> = {};
373365

374366
let reportIDDeeplinkedFromOldDot: string | undefined;
@@ -3369,7 +3361,12 @@ function doneCheckingPublicRoom() {
33693361
Onyx.set(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, false);
33703362
}
33713363

3372-
function openReportFromDeepLink(url: string, currentOnboardingPurposeSelected: OnyxEntry<OnboardingPurpose>, currentOnboardingCompanySize: OnyxEntry<OnboardingCompanySize>) {
3364+
function openReportFromDeepLink(
3365+
url: string,
3366+
currentOnboardingPurposeSelected: OnyxEntry<OnboardingPurpose>,
3367+
currentOnboardingCompanySize: OnyxEntry<OnboardingCompanySize>,
3368+
onboardingInitialPath: OnyxEntry<string>,
3369+
) {
33733370
const reportID = getReportIDFromLink(url);
33743371
const isAuthenticated = hasAuthToken();
33753372

0 commit comments

Comments
 (0)