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)
This commit is contained in:
Kevin Grüneberg authored and GitHub committed 2025-10-06 15:49:51 +08:00
1 parent 1e6941df4d
commit 92ce7fb4e1
2 files changed
+2 -2

No files matched your search

@@ -57,7 +57,7 @@ export const BillingSettings = () => {
<ScaffoldDivider />
{org?.plan.id !== 'free' && (
{org && org.plan.id !== 'free' && (
<ScaffoldContainer id="breakdown">
<BillingBreakdown />
</ScaffoldContainer>
+1 -1
View File
@@ -44,7 +44,7 @@ export const useOrgUsageQuery = <TData = OrgUsageData>(
({ 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,
}
)