The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
[FE-1648] fix: privacy settings failed to load state (#35869)
Alaister Young50518c897a7f
diff --git a/apps/studio/components/interfaces/Account/Preferences/AnalyticsSettings.tsx b/apps/studio/components/interfaces/Account/Preferences/AnalyticsSettings.tsxindex e75da7acd71..c2b317e220d 100644--- a/apps/studio/components/interfaces/Account/Preferences/AnalyticsSettings.tsx+++ b/apps/studio/components/interfaces/Account/Preferences/AnalyticsSettings.tsx@@ -1,14 +1,24 @@-import { Toggle } from 'ui'+import { toast } from 'sonner'import { useConsentState } from 'common'import Panel from 'components/ui/Panel'import { useSendResetMutation } from 'data/telemetry/send-reset-mutation'+import { Toggle } from 'ui'export const AnalyticsSettings = () => {- const { hasAccepted, acceptAll, denyAll } = useConsentState()+ const { hasAccepted, acceptAll, denyAll, categories } = useConsentState()+ const hasLoaded = categories !== null+const { mutate: sendReset } = useSendResetMutation()const onToggleOptIn = () => {+ if (!hasLoaded) {+ toast.error(+ "We couldn't load the privacy settings due to an ad blocker or network error. Please disable any ad blockers and try again. If the problem persists, please contact support."+ )+ return+ }+if (hasAccepted) {denyAll()sendReset()diff --git a/packages/ui-patterns/PrivacySettings/index.tsx b/packages/ui-patterns/PrivacySettings/index.tsxindex 616b142936c..ec2442bb417 100644--- a/packages/ui-patterns/PrivacySettings/index.tsx+++ b/packages/ui-patterns/PrivacySettings/index.tsx@@ -1,9 +1,11 @@'use client'-import { useConsentState } from 'common'import Link from 'next/link'import { PropsWithChildren, useState } from 'react'++import { useConsentState } from 'common'import { Modal, Toggle } from 'ui'+import { Admonition } from '../admonition'interface PrivacySettingsProps {className?: string@@ -64,7 +66,24 @@ export const PrivacySettings = ({size="medium"><div className="pt-3 divide-y divide-border">- {categories &&+ {categories === null ? (+ <Modal.Content>+ <Admonition+ type="warning"+ title="Unable to Load Privacy Settings"+ description={+ <>+ We couldn't load the privacy settings due to an ad blocker or network error.+ Please disable any ad blockers and try again. If the problem persists, please{' '}+ <Link href="https://supabase.com/dashboard/support/new" className="underline">+ contact support+ </Link>+ .+ </>+ }+ />+ </Modal.Content>+ ) : ([...categories].reverse().map((category) => (@@ -73,7 +92,8 @@ export const PrivacySettings = ({category={category}handleServicesChange={handleServicesChange}/>- ))}+ ))+ )}</div></Modal></>