Skip to content

Commit 2730bae

Browse files
MelvinBoteh2077
andcommitted
Remove deferred scheduleNavigationCheck pattern for simplicity
Co-authored-by: Eric Han <eh2077@users.noreply.github.com>
1 parent 096c2e1 commit 2730bae

1 file changed

Lines changed: 2 additions & 19 deletions

File tree

src/libs/Navigation/guards/MigratedUserWelcomeModalGuard.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ function resetSessionFlag() {
2525
hasRedirectedToMigratedUserModal = false;
2626
}
2727

28-
let pendingNavigationCheck: ReturnType<typeof setTimeout> | undefined;
29-
30-
/**
31-
* Schedules a deferred navigation check. The check is deferred to the next event loop tick
32-
* so it doesn't run synchronously inside Onyx callbacks, which would interfere with
33-
* Onyx batch processing and cause extra component renders.
34-
*/
35-
function scheduleNavigationCheck() {
36-
if (pendingNavigationCheck !== undefined) {
37-
return;
38-
}
39-
pendingNavigationCheck = setTimeout(() => {
40-
pendingNavigationCheck = undefined;
41-
navigateToMigratedUserWelcomeModalIfReady();
42-
}, 0);
43-
}
44-
4528
/**
4629
* Proactively navigate to the migrated user welcome modal when all conditions are met,
4730
* without waiting for a user-initiated navigation action.
@@ -70,15 +53,15 @@ function navigateToMigratedUserWelcomeModalIfReady() {
7053
function onSessionOrLoadingAppChanged(sessionValue: OnyxEntry<Session>, isLoadingAppValue: boolean) {
7154
session = sessionValue;
7255
isLoadingApp = isLoadingAppValue;
73-
scheduleNavigationCheck();
56+
navigateToMigratedUserWelcomeModalIfReady();
7457
}
7558

7659
Onyx.connectWithoutView({
7760
key: ONYXKEYS.NVP_TRY_NEW_DOT,
7861
callback: (value) => {
7962
const result = value ? tryNewDotOnyxSelector(value) : undefined;
8063
hasBeenAddedToNudgeMigration = result?.hasBeenAddedToNudgeMigration ?? false;
81-
scheduleNavigationCheck();
64+
navigateToMigratedUserWelcomeModalIfReady();
8265
},
8366
});
8467

0 commit comments

Comments
 (0)