Files
supabase/apps/studio/components/interfaces/Home/ProjectUsageSection.tsx
Ivan Vasilov 0d5be306ef chore: Bump React Query to v5 (#40174)
* Bump the deps, refactor deprecated code.

* Migrate keepPreviousData usage.

* Migrate all uses of InfiniteQuery.

* Fix refetchInterval in queries.

* Migrate all use of isLoading to isPending in mutations.

* Fix accessing location in claim-project.

* Fix a bug in duplicate query keys.

* Migrate all queries to use isPending.

* Revert "Fix accessing location in claim-project."

This reverts commit 2a07df64b5.

* Revert the rss.xml file to master.
2025-12-10 10:10:29 +01:00

39 lines
1.3 KiB
TypeScript

import { AlertCircle } from 'lucide-react'
import { ProjectUsageLoadingState } from 'components/layouts/ProjectLayout/LoadingState'
import InformationBox from 'components/ui/InformationBox'
import { useProjectLogRequestsCountQuery } from 'data/analytics/project-log-requests-count-query'
import { useProjectLogStatsQuery } from 'data/analytics/project-log-stats-query'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import ProjectUsage from './ProjectUsage'
export const ProjectUsageSection = () => {
const { data: project } = useSelectedProjectQuery()
const { error, isPending: isLoading } = useProjectLogRequestsCountQuery({
projectRef: project?.ref,
})
// wait for the stats to load before showing the usage section to eliminate multiple spinners
const { isPending: isLogsStatsLoading } = useProjectLogStatsQuery({
projectRef: project?.ref,
interval: '1hr',
})
if (isLoading || isLogsStatsLoading) {
return <ProjectUsageLoadingState />
}
if (error) {
return (
<InformationBox
hideCollapse
defaultVisibility
icon={<AlertCircle size={18} strokeWidth={2} />}
title="There was an issue loading the usage details of your project"
/>
)
}
return <ProjectUsage />
}