mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03:00
Merge pull request #14902 from supabase/fix/usage-end-date
fix: usage v2 end date
This commit is contained in:
3 files changed
+6
-6
No files matched your search
@@ -16,7 +16,7 @@ import MembersExceedLimitModal from './MembersExceedLimitModal'
|
||||
import PaymentMethodSelection from './PaymentMethodSelection'
|
||||
import { plans as subscriptionsPlans } from 'shared-data/plans'
|
||||
import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'
|
||||
import { PRICING_TIER_PRODUCT_IDS, STRIPE_PRODUCT_IDS } from 'lib/constants'
|
||||
import { PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
|
||||
|
||||
const TierUpdateSidePanel = () => {
|
||||
const { ui } = useStore()
|
||||
|
||||
@@ -63,18 +63,18 @@ const Usage = () => {
|
||||
}, [dateRange, subscription])
|
||||
|
||||
const endDate = useMemo(() => {
|
||||
// If end date is in future, set end date to now
|
||||
// If end date is in future, set end date to end of current day
|
||||
if (dateRange?.period_end?.date && dayjs(dateRange.period_end.date).isAfter(dayjs())) {
|
||||
// LF seems to have an issue with the milliseconds, causes infinite loading sometimes
|
||||
return new Date().toISOString().slice(0, -5) + 'Z'
|
||||
// In order to have full days from Prometheus metrics when using 1d interval,
|
||||
// the time needs to be greater or equal than the time of the start date
|
||||
return dayjs().endOf('day').toISOString().slice(0, -5) + 'Z'
|
||||
} else if (dateRange?.period_end?.date) {
|
||||
// LF seems to have an issue with the milliseconds, causes infinite loading sometimes
|
||||
return new Date(dateRange.period_end.date).toISOString().slice(0, -5) + 'Z'
|
||||
}
|
||||
}, [dateRange, subscription])
|
||||
|
||||
console.log({ startDate, endDate })
|
||||
|
||||
const { data: ioBudgetData } = useInfraMonitoringQuery({
|
||||
projectRef: selectedProjectRef,
|
||||
attribute: 'disk_io_budget',
|
||||
|
||||
@@ -131,7 +131,7 @@ export const useDailyStatsQuery = <TData = DailyStatsData>(
|
||||
typeof endDate !== 'undefined',
|
||||
|
||||
select(data) {
|
||||
const noDataYet = data.data[0].id === undefined
|
||||
const noDataYet = data.data[0]?.id === undefined
|
||||
|
||||
// [Joshen] Ideally handled by API, like infra-monitoring
|
||||
if (noDataYet) {
|
||||
|
||||
Reference in new issue
Block a user