Manage state of price-lookup calls (#5915)

Now calls stripe-price-lookup once when prices are required rather then
bombarding on every rerender
This commit is contained in:
ConnorYoh
2026-03-11 13:53:49 +00:00
committed by GitHub
parent 32cf6866f3
commit d5d03b9ada
7 changed files with 136 additions and 143 deletions
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { Box, Text, Stack } from '@mantine/core';
import { useSaaSBilling } from '@app/contexts/SaasBillingContext';
import { BILLING_CONFIG } from '@app/config/billing';
import { connectionModeService } from '@app/services/connectionModeService';
import { authService } from '@app/services/authService';
import { CREDIT_EVENTS } from '@app/constants/creditEvents';
@@ -49,7 +50,7 @@ export function QuickAccessBarFooterExtensions({ className }: QuickAccessBarFoot
// - Still loading billing data
// - User is a managed team member (unlimited credits)
// - Credits >= 20 (only show when low)
if (!isSaasMode || !isAuthenticated || loading || isManagedTeamMember || creditBalance >= 20) {
if (!isSaasMode || !isAuthenticated || loading || isManagedTeamMember || creditBalance >= BILLING_CONFIG.PLAN_PRICING_PRELOAD_THRESHOLD) {
return null;
}