The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: Add a catch block around a JSON.parse when rendering AI assistant messages (#34671)
Ivan Vasilov86a690b00a1f
diff --git a/apps/studio/components/ui/AIAssistantPanel/MessageMarkdown.tsx b/apps/studio/components/ui/AIAssistantPanel/MessageMarkdown.tsxindex d4d75192eaf..5fe0885cde1 100644--- a/apps/studio/components/ui/AIAssistantPanel/MessageMarkdown.tsx+++ b/apps/studio/components/ui/AIAssistantPanel/MessageMarkdown.tsx@@ -185,10 +185,14 @@ export const MarkdownPre = ({const rawContent = children[0].props.children[0]const propsMatch = rawContent.match(/(?:--|\/\/)\s*props:\s*(\{[^}]+\})/)- const snippetProps: AssistantSnippetProps = useMemo(- () => (propsMatch ? JSON.parse(propsMatch[1]) : {}),- [propsMatch]- )+ const snippetProps: AssistantSnippetProps = useMemo(() => {+ try {+ if (propsMatch) {+ return JSON.parse(propsMatch[1])+ }+ } catch {}+ return {}+ }, [propsMatch])const { xAxis, yAxis } = snippetPropsconst snippetId = snippetProps.id