Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix undefined tier

Terry Sutton7c0d6c5e820b
diff --git a/studio/components/interfaces/Settings/Logs/Logs.utils.ts b/studio/components/interfaces/Settings/Logs/Logs.utils.ts
index 73d1a94eca2..0731ba6dbc5 100644
--- a/studio/components/interfaces/Settings/Logs/Logs.utils.ts
+++ b/studio/components/interfaces/Settings/Logs/Logs.utils.ts
@@ -173,7 +173,7 @@ export const genSingleLogQuery = (table: LogsTableName, id: string) =>
*/
export const maybeShowUpgradePrompt = (
from: string | null | undefined,
- tier: StripeSubscription['tier'] | undefined
+ tier: StripeSubscription['tier']
) => {
const day = Math.abs(dayjs().diff(dayjs(from), 'day'))
diff --git a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
index f85f98ade74..5daca461bd4 100644
--- a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx
@@ -22,6 +22,7 @@ import ShimmerLine from 'components/ui/ShimmerLine'
import LoadingOpacity from 'components/ui/LoadingOpacity'
import { useProjectSubscription } from 'hooks'
import { useUpgradePrompt } from 'hooks/misc/useUpgradePrompt'
+import { StripeProduct } from 'components/interfaces/Billing'
/**
* Acts as a container component for the entire log display
@@ -117,7 +118,7 @@ export const LogsPreviewer: React.FC<Props> = ({
},
})
} else if (event === 'datepicker-change') {
- const shouldShowUpgradePrompt = maybeShowUpgradePrompt(from, tier)
+ const shouldShowUpgradePrompt = maybeShowUpgradePrompt(from, tier as StripeProduct)
if (shouldShowUpgradePrompt) {
setShowUpgradePrompt(!showUpgradePrompt)
diff --git a/studio/hooks/misc/useUpgradePrompt.tsx b/studio/hooks/misc/useUpgradePrompt.tsx
index d9b0c548b3a..b201583e1e7 100644
--- a/studio/hooks/misc/useUpgradePrompt.tsx
+++ b/studio/hooks/misc/useUpgradePrompt.tsx
@@ -4,6 +4,7 @@ import { useProjectSubscription } from 'hooks'
import { useRouter } from 'next/router'
import { maybeShowUpgradePrompt, TIER_QUERY_LIMITS } from 'components/interfaces/Settings/Logs'
import Link from 'next/link'
+import { StripeProduct } from 'components/interfaces/Billing'
export const useUpgradePrompt = (from: any) => {
const router = useRouter()
@@ -12,7 +13,7 @@ export const useUpgradePrompt = (from: any) => {
const tier = subscription?.tier
const [showUpgradePrompt, setShowUpgradePrompt] = useState(false)
- const shouldShowUpgradePrompt = maybeShowUpgradePrompt(from, tier)
+ const shouldShowUpgradePrompt = maybeShowUpgradePrompt(from, tier as StripeProduct)
useEffect(() => {
if (shouldShowUpgradePrompt) {
diff --git a/studio/pages/project/[ref]/logs-explorer/index.tsx b/studio/pages/project/[ref]/logs-explorer/index.tsx
index f448729a8fa..7b588f21e5c 100644
--- a/studio/pages/project/[ref]/logs-explorer/index.tsx
+++ b/studio/pages/project/[ref]/logs-explorer/index.tsx
@@ -25,6 +25,7 @@ import {
TEMPLATES,
} from 'components/interfaces/Settings/Logs'
import { useUpgradePrompt } from 'hooks/misc/useUpgradePrompt'
+import { StripeProduct } from 'components/interfaces/Billing'
export const LogsExplorerPage: NextPageWithLayout = () => {
const router = useRouter()
@@ -114,7 +115,7 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
}
const handleDateChange = ({ to, from }: DatePickerToFrom) => {
- const shouldShowUpgradePrompt = maybeShowUpgradePrompt(from, tier)
+ const shouldShowUpgradePrompt = maybeShowUpgradePrompt(from, tier as StripeProduct)
if (shouldShowUpgradePrompt) {
setShowUpgradePrompt(!showUpgradePrompt)