fix: prevent auth flash on checkout, skip subscription guard on success return
This commit is contained in:
@@ -136,12 +136,13 @@ function CheckoutContent() {
|
||||
}
|
||||
}, [authLoading, user, router])
|
||||
|
||||
// -- Subscription guard --
|
||||
// -- Subscription guard (skip on success page — it handles its own redirect) --
|
||||
useEffect(() => {
|
||||
if (status === 'success') return
|
||||
if (subscription && (subscription.subscription_status === 'active' || subscription.subscription_status === 'trialing')) {
|
||||
router.replace('/')
|
||||
}
|
||||
}, [subscription, router])
|
||||
}, [subscription, status, router])
|
||||
|
||||
// -- Param validation --
|
||||
useEffect(() => {
|
||||
|
||||
@@ -98,8 +98,8 @@ function LayoutInner({ children }: { children: React.ReactNode }) {
|
||||
return <LoadingOverlay logoSrc="/pulse_icon_no_margins.png" title="Pulse" portal={false} />
|
||||
}
|
||||
|
||||
// While auth is loading on a site page, render nothing to prevent flash of public header
|
||||
if (auth.loading && isSitePage) {
|
||||
// While auth is loading on a site or checkout page, render nothing to prevent flash of public header
|
||||
if (auth.loading && (isSitePage || isCheckoutPage)) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user