From 92ce7fb4e153b9fecc440eb9d8cf7216e7eb2901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Gr=C3=BCneberg?= Date: Mon, 6 Oct 2025 15:49:51 +0800 Subject: [PATCH] chore: cache time usage / do not preload invoice breakdown (#39278) - Increase cache time of usage to 60m - Ensure org is fully loaded before rendering invoice breakdown (this currently leads to starting to load this endpoint and then cancelling it when directly landing on the org billing page) --- .../interfaces/Organization/BillingSettings/BillingSettings.tsx | 2 +- apps/studio/data/usage/org-usage-query.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/BillingSettings.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/BillingSettings.tsx index 884b39bee9e..bcb1c3f0f0b 100644 --- a/apps/studio/components/interfaces/Organization/BillingSettings/BillingSettings.tsx +++ b/apps/studio/components/interfaces/Organization/BillingSettings/BillingSettings.tsx @@ -57,7 +57,7 @@ export const BillingSettings = () => { - {org?.plan.id !== 'free' && ( + {org && org.plan.id !== 'free' && ( diff --git a/apps/studio/data/usage/org-usage-query.ts b/apps/studio/data/usage/org-usage-query.ts index 9b6f4ae4344..4110c6660c2 100644 --- a/apps/studio/data/usage/org-usage-query.ts +++ b/apps/studio/data/usage/org-usage-query.ts @@ -44,7 +44,7 @@ export const useOrgUsageQuery = ( ({ signal }) => getOrgUsage({ orgSlug, projectRef, start, end }, signal), { enabled: enabled && IS_PLATFORM && typeof orgSlug !== 'undefined', - staleTime: 1000 * 60 * 30, // 30 mins, underlying usage data only refreshes once an hour, so safe to cache for a while + staleTime: 1000 * 60 * 60, // 60 mins, underlying usage data only refreshes once an hour, so safe to cache for a while ...options, } )