The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Clear IndexedDB (#37495)
Saxon Fletcher578b707e8bce
diff --git a/apps/studio/lib/auth.tsx b/apps/studio/lib/auth.tsxindex 18ef96866c1..92663680c91 100644--- a/apps/studio/lib/auth.tsx+++ b/apps/studio/lib/auth.tsx@@ -8,6 +8,7 @@ import {import { PropsWithChildren, useCallback, useEffect } from 'react'import { toast } from 'sonner'+import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state'import { GOTRUE_ERRORS, IS_PLATFORM } from './constants'const AuthErrorToaster = ({ children }: PropsWithChildren) => {@@ -42,12 +43,15 @@ export { useAuth, useIsLoggedIn, useSession, useUser } from 'common'export function useSignOut() {const queryClient = useQueryClient()+ const { clearStorage: clearAssistantStorage } = useAiAssistantStateSnapshot()return useCallback(async () => {const result = await gotrueClient.signOut()clearLocalStorage()+ // Clear Assistant IndexedDB+ await clearAssistantStorage()await queryClient.clear()return result- }, [queryClient])+ }, [queryClient, clearAssistantStorage])}diff --git a/apps/studio/state/ai-assistant-state.tsx b/apps/studio/state/ai-assistant-state.tsxindex c6047f3e8be..b33feb97047 100644--- a/apps/studio/state/ai-assistant-state.tsx+++ b/apps/studio/state/ai-assistant-state.tsx@@ -95,6 +95,15 @@ async function saveAiState(state: StoredAiAssistantState): Promise<void> {}}+async function clearStorage(): Promise<void> {+ try {+ const db = await openAiDb()+ await db.clear(STORE_NAME)+ } catch (error) {+ console.error('Failed to clear AI state from IndexedDB:', error)+ }+}+// Helper function to load state from IndexedDBasync function loadFromIndexedDB(projectRef: string): Promise<StoredAiAssistantState | null> {try {@@ -387,6 +396,10 @@ export const createAiAssistantState = (): AiAssistantState => {}}},++ clearStorage: async () => {+ await clearStorage()+ },})return state@@ -413,6 +426,7 @@ export type AiAssistantState = AiAssistantData & {clearSqlSnippets: () => voidgetCachedSQLResults: (args: { messageId: string; snippetId?: string }) => any[] | undefinedloadPersistedState: (persistedState: StoredAiAssistantState) => void+ clearStorage: () => Promise<void>}export const AiAssistantStateContext = createContext<AiAssistantState>(createAiAssistantState())