fix: wait for user data before showing paywall, skip for temporary users
Ensures the UpgradeBlockProvider waits for both user and organization data before computing the block reason, preventing premature paywall flash. Temporary users are never blocked. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c5d8585918
commit
1268a268c1
1 changed files with 7 additions and 5 deletions
|
|
@ -28,18 +28,20 @@ export const UpgradeBlockProvider: React.FC<UpgradeBlockProviderProps> = ({ chil
|
|||
const { data: organizationData } = useOrganization();
|
||||
const user = useMaybeUser();
|
||||
|
||||
// Wait for both user and organization data before deciding.
|
||||
// Temporary users are never blocked — they have read-only access enforced at the API level.
|
||||
const reason =
|
||||
user?.is_temporary
|
||||
!user || !organizationData
|
||||
? null
|
||||
: organizationData
|
||||
? getOrganizationUpgradeBlockReason({
|
||||
: user.is_temporary
|
||||
? null
|
||||
: getOrganizationUpgradeBlockReason({
|
||||
is_trial_expired: organizationData.is_trial_expired,
|
||||
required_plan: organizationData.required_plan,
|
||||
required_team_quantity: organizationData.required_team_quantity,
|
||||
active_subscription_plan: organizationData.active_subscription_plan,
|
||||
active_subscription_quantity: organizationData.active_subscription_quantity,
|
||||
})
|
||||
: null;
|
||||
});
|
||||
|
||||
const isBlocked = reason !== null;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue