From a08709e82159b5cb4dd2f01ee1b93b2553e925a1 Mon Sep 17 00:00:00 2001 From: Darshan Date: Fri, 28 Feb 2025 12:43:45 +0530 Subject: [PATCH] fix: count logic for `PHP_INT_MAX` on `JS`! --- src/lib/components/billing/usageRates.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/components/billing/usageRates.svelte b/src/lib/components/billing/usageRates.svelte index 87f6b0028..699241134 100644 --- a/src/lib/components/billing/usageRates.svelte +++ b/src/lib/components/billing/usageRates.svelte @@ -50,6 +50,13 @@ ]; $: isFree = org.billingPlan === BillingPlan.FREE; + + // equal or above means unlimited! + $: getCorrectSeatsCountValue = (count: number): string | number => { + // php int max is always larger than js + const exceedsSafeLimit = count >= Number.MAX_SAFE_INTEGER; + return exceedsSafeLimit ? 'Unlimited' : count || 0; + }; @@ -81,7 +88,7 @@ {usage.resource} - {plan.addons.seats.limit || 0} + {getCorrectSeatsCountValue(plan.addons.seats.limit)} {#if !isFree}