From fc3d92c2a3756c8262b0054ea0fdacfd15fd2679 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 28 Jul 2026 16:21:35 +0700 Subject: [PATCH] prevent trial payment reminder modal flicker on login --- src/hooks/useTrialPaymentReminder.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useTrialPaymentReminder.ts b/src/hooks/useTrialPaymentReminder.ts index 90c3bd188b02..32f8c48749ce 100644 --- a/src/hooks/useTrialPaymentReminder.ts +++ b/src/hooks/useTrialPaymentReminder.ts @@ -151,6 +151,7 @@ function useTrialPaymentReminder() { const [lastDayFreeTrial] = useOnyx(ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL); const [billingFundID, billingFundIDResult] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID); const [dismissedTimestamp, dismissedTimestampResult] = useOnyx(ONYXKEYS.NVP_DISMISSED_TRIAL_PAYMENT_REMINDER); + const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP); const [readinessState, setReadinessState] = useState(READINESS_STATE.LOADING); @@ -219,6 +220,9 @@ function useTrialPaymentReminder() { }, [firstDayFreeTrial, lastDayFreeTrial, billingFundID]); const isEligibleToShow = useMemo(() => { + if (!hasLoadedApp) { + return false; + } if (!isUserOnFreeTrial(firstDayFreeTrial, lastDayFreeTrial)) { return false; } @@ -245,7 +249,7 @@ function useTrialPaymentReminder() { } } return true; - }, [firstDayFreeTrial, lastDayFreeTrial, billingFundID, billingFundIDResult, readinessState, currentVariation, dismissedTimestamp, dismissedTimestampResult]); + }, [hasLoadedApp, firstDayFreeTrial, lastDayFreeTrial, billingFundID, billingFundIDResult, readinessState, currentVariation, dismissedTimestamp, dismissedTimestampResult]); // Run the 1s countdown only while the countdown modal is actually eligible to show, so we don't tick every // second in the background when it isn't rendered.