The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: future-proof sending of feedback query (#22754)
Charis9159bcf45556
diff --git a/apps/docs/components/Feedback/Feedback.tsx b/apps/docs/components/Feedback/Feedback.tsxindex 0359b20e360..4694e338e20 100644--- a/apps/docs/components/Feedback/Feedback.tsx+++ b/apps/docs/components/Feedback/Feedback.tsx@@ -16,6 +16,7 @@ import { Button, cn } from 'ui'import { useSendFeedbackMutation } from '~/lib/fetch/feedback'import { useSendTelemetryEvent } from '~/lib/telemetry'import { FeedbackModal, type FeedbackFields } from './FeedbackModal'+import { getSanitizedTabParams } from './Feedback.utils'const FeedbackButton = forwardRef<HTMLButtonElement,@@ -89,7 +90,7 @@ function Feedback() {vote: response,page: pathname,metadata: {- query: Object.fromEntries(new URLSearchParams(window.location.search).entries()),+ query: getSanitizedTabParams(),},})if (error) console.error(error)diff --git a/apps/docs/components/Feedback/Feedback.utils.ts b/apps/docs/components/Feedback/Feedback.utils.tsnew file mode 100644index 00000000000..bc3683490f0--- /dev/null+++ b/apps/docs/components/Feedback/Feedback.utils.ts@@ -0,0 +1,16 @@+import { pick } from 'lodash'++/**+ * Gets the tab selection state from the URL search params.+ *+ * Sanitizes by including only those search params that are explicitly marked+ * as query groups.+ */+const getSanitizedTabParams = () => {+ const searchParams = new URLSearchParams(window.location.search)+ const queryGroups = searchParams.getAll('queryGroups')++ return pick(Object.fromEntries(searchParams.entries()), queryGroups)+}++export { getSanitizedTabParams }diff --git a/packages/ui/src/components/Tabs/Tabs.tsx b/packages/ui/src/components/Tabs/Tabs.tsxindex 4f8bb233531..1087e37c47f 100644--- a/packages/ui/src/components/Tabs/Tabs.tsx+++ b/packages/ui/src/components/Tabs/Tabs.tsx@@ -115,6 +115,8 @@ const Tabs: React.FC<PropsWithChildren<TabsProps>> & TabsSubComponents = ({if (queryGroup) {const url = new URL(document.location.href)+ if (!url.searchParams.getAll('queryGroups')?.includes(queryGroup))+ url.searchParams.append('queryGroups', queryGroup)url.searchParams.set(queryGroup, id)window.history.replaceState(undefined, '', url)}