Skip to content

Commit fc3d92c

Browse files
committed
prevent trial payment reminder modal flicker on login
1 parent 7392971 commit fc3d92c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/hooks/useTrialPaymentReminder.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function useTrialPaymentReminder() {
151151
const [lastDayFreeTrial] = useOnyx(ONYXKEYS.NVP_LAST_DAY_FREE_TRIAL);
152152
const [billingFundID, billingFundIDResult] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
153153
const [dismissedTimestamp, dismissedTimestampResult] = useOnyx(ONYXKEYS.NVP_DISMISSED_TRIAL_PAYMENT_REMINDER);
154+
const [hasLoadedApp] = useOnyx(ONYXKEYS.HAS_LOADED_APP);
154155

155156
const [readinessState, setReadinessState] = useState<ReadinessState>(READINESS_STATE.LOADING);
156157

@@ -219,6 +220,9 @@ function useTrialPaymentReminder() {
219220
}, [firstDayFreeTrial, lastDayFreeTrial, billingFundID]);
220221

221222
const isEligibleToShow = useMemo(() => {
223+
if (!hasLoadedApp) {
224+
return false;
225+
}
222226
if (!isUserOnFreeTrial(firstDayFreeTrial, lastDayFreeTrial)) {
223227
return false;
224228
}
@@ -245,7 +249,7 @@ function useTrialPaymentReminder() {
245249
}
246250
}
247251
return true;
248-
}, [firstDayFreeTrial, lastDayFreeTrial, billingFundID, billingFundIDResult, readinessState, currentVariation, dismissedTimestamp, dismissedTimestampResult]);
252+
}, [hasLoadedApp, firstDayFreeTrial, lastDayFreeTrial, billingFundID, billingFundIDResult, readinessState, currentVariation, dismissedTimestamp, dismissedTimestampResult]);
249253

250254
// Run the 1s countdown only while the countdown modal is actually eligible to show, so we don't tick every
251255
// second in the background when it isn't rendered.

0 commit comments

Comments
 (0)