Skip to content

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

fix:error filter for troubleshooting (#33010)

Charisa5b51862b9f3
diff --git a/apps/docs/features/app.providers.tsx b/apps/docs/features/app.providers.tsx
index ed5654a9f59..d07b3fda3cd 100644
--- a/apps/docs/features/app.providers.tsx
+++ b/apps/docs/features/app.providers.tsx
@@ -1,6 +1,6 @@
import { type PropsWithChildren } from 'react'
-import { FeatureFlagProvider, ThemeProvider } from 'common'
+import { FeatureFlagProvider, IS_PLATFORM, ThemeProvider } from 'common'
import { SonnerToaster } from 'ui'
import { CommandProvider } from 'ui-patterns/CommandMenu'
import SiteLayout from '~/layouts/SiteLayout'
@@ -19,7 +19,7 @@ function GlobalProviders({ children }: PropsWithChildren) {
return (
<QueryClientProvider>
<AuthContainer>
- <FeatureFlagProvider API_URL={API_URL}>
+ <FeatureFlagProvider API_URL={API_URL} enabled={IS_PLATFORM}>
<PageTelemetry />
<ScrollRestoration />
<ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
diff --git a/apps/docs/features/docs/Troubleshooting.ui.client.tsx b/apps/docs/features/docs/Troubleshooting.ui.client.tsx
index 276262a614c..9ba084e6b74 100644
--- a/apps/docs/features/docs/Troubleshooting.ui.client.tsx
+++ b/apps/docs/features/docs/Troubleshooting.ui.client.tsx
@@ -2,7 +2,7 @@
import { ChevronDown, RotateCw, Search, X } from 'lucide-react'
import { useQueryStates } from 'nuqs'
-import { useEffect, useRef, useState, Suspense, useCallback } from 'react'
+import { useEffect, useRef, useState, Suspense, useCallback, useMemo } from 'react'
import {
Input_Shadcn_,
@@ -14,7 +14,6 @@ import {
} from 'ui'
import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'
-import { MultiSelect } from '~/components/MultiSelect.client'
import {
MultiSelector,
MultiSelectorContent,
@@ -107,7 +106,9 @@ function entryMatchesFilter(
selectedTags.length === 0 || selectedTags.some((tag) => dataKeywords?.includes(tag))
const errorsMatch =
selectedErrorCodes.length === 0 ||
- selectedErrorCodes.some((error) => dataErrors.includes(error))
+ selectedErrorCodes.some((error) =>
+ dataErrors.some((errorCode) => errorCode.includes(error.toString()))
+ )
const searchMatch =
searchState === '' || content.toLowerCase().includes(searchState.toLowerCase())
@@ -200,6 +201,25 @@ function TroubleshootingFilterInternal({
allEntries.current = entries
}, [])
+ const allErrorCodes: string[] = useMemo(
+ () =>
+ Array.from(
+ new Set(
+ errors?.flatMap((error) => {
+ const result: string[] = []
+ if (error.http_status_code) {
+ result.push(String(error.http_status_code))
+ }
+ if (error.code) {
+ result.push(error.code)
+ }
+ return result
+ }) ?? []
+ )
+ ),
+ [errors]
+ )
+
return (
<>
<h2 className="sr-only">Search and filter</h2>
@@ -220,9 +240,9 @@ function TroubleshootingFilterInternal({
<MultiSelector.Trigger badgeLimit={1} className="w-48" label="Error codes" />
<MultiSelector.Content>
<MultiSelector.List>
- {errors?.map((error) => (
- <MultiSelector.Item key={`error-${error.code}`} value={error.code}>
- {error.code}
+ {allErrorCodes.map((error) => (
+ <MultiSelector.Item key={`error-${error}`} value={error}>
+ {error}
</MultiSelector.Item>
))}
</MultiSelector.List>
diff --git a/apps/docs/features/docs/Troubleshooting.utils.ts b/apps/docs/features/docs/Troubleshooting.utils.ts
index 6dc915d8628..4189c9c5da7 100644
--- a/apps/docs/features/docs/Troubleshooting.utils.ts
+++ b/apps/docs/features/docs/Troubleshooting.utils.ts
@@ -27,7 +27,9 @@ export interface ITroubleshootingEntry {
export const getArticleSlug = getArticleSlugInternal
async function getAllTroubleshootingEntriesTyped() {
- const result = (await getAllTroubleshootingEntriesInternal()) as ITroubleshootingEntry[]
+ const result: ITroubleshootingEntry[] = (
+ IS_PLATFORM ? await getAllTroubleshootingEntriesInternal() : []
+ ) as ITroubleshootingEntry[]
return result
}
export const getAllTroubleshootingEntries = cache_fullProcess_withDevCacheBust(