:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(max): keep visualization artifacts full width in the thread (#123813)
Adam Leithab8a7290e743
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex c0c87c79b06f..f65758f110c7 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -14473,9 +14473,9 @@ snapshots:scenes-app-posthog-ai--shared-thread--light:hash: v1.k794b7964.08f4d570bad30aeabec4558d538fb3f87ad127f5ad28c37d60805c6f306615ba.Y9cV3pW4s0aPCq6v1FZ3z13bqJaRbABUQIbnJQDCCXIscenes-app-posthog-ai--thread--dark:- hash: v1.k794b7964.7e4119b8d4a9d0fa13f6766eee2fa34b6648a05a8daeb886850a16ea0fb343a1.JcepCXnx9hBCQk4gj_2NolDnARJcpzadLiuPOmkJokk+ hash: v1.k794b7964.848aa8fa56ef9bc701cd2ff81c6862d7c61306767153fd32dce501451813e9ee.Qzp4VIFht6chfBae10zwGmh9PsI0fPb4s1H1QW6Zkccscenes-app-posthog-ai--thread--light:- hash: v1.k794b7964.e1634750116e9a68c58a0faf1dd19c03e1663b606fe7d3c606a098c7565df35c.Xt7_Pk5CFvoD1b3Y9GpnFNplQfRwKlELeALVlKXuRSE+ hash: v1.k794b7964.2b3e53d46e15e282dccdbc3344af068b802b94150084909f88a9375df3037590.8oP4_JUEugY8LGyu3CeDSM3Rg_lN0Elf-0-gPbkjW3Escenes-app-posthog-ai--thread-scrolls-to-bottom-on-new-messages--dark:hash: v1.k794b7964.6308f9e71b7f609897baee5c5fe5af1deb321882ecb0761fbf22051bb6531999.YXmikTdEmed3mJWRiglAFw66r284ajZbdJI5sT8kUAIscenes-app-posthog-ai--thread-scrolls-to-bottom-on-new-messages--light:diff --git a/frontend/src/scenes/max/Thread.tsx b/frontend/src/scenes/max/Thread.tsxindex d20794796bdb..79326ac8eb00 100644--- a/frontend/src/scenes/max/Thread.tsx+++ b/frontend/src/scenes/max/Thread.tsx@@ -846,16 +846,14 @@ const Message = React.memo(function Message({} else if (isArtifactMessage(message)) {if (isVisualizationArtifactContent(message.content)) {return (- // A chart card needs more room from the text around it than the thread's row gap gives.- <div key={key} className={quill ? 'my-2' : undefined}>- <VisualizationArtifact- message={message}- content={message.content}- status={message.status}- isEditingInsight={editInsightToolRegistered}- activeSceneId={activeSceneId}- />- </div>+ <VisualizationArtifact+ key={key}+ message={message}+ content={message.content}+ status={message.status}+ isEditingInsight={editInsightToolRegistered}+ activeSceneId={activeSceneId}+ />)} else if (isNotebookArtifactContent(message.content)) {return (diff --git a/frontend/src/scenes/max/messages/VisualizationArtifact.tsx b/frontend/src/scenes/max/messages/VisualizationArtifact.tsxindex c52df6a2ef3c..337ef2e6cbc7 100644--- a/frontend/src/scenes/max/messages/VisualizationArtifact.tsx+++ b/frontend/src/scenes/max/messages/VisualizationArtifact.tsx@@ -11,6 +11,7 @@ import { Scene } from 'scenes/sceneTypes'import { ArtifactMessage, VisualizationArtifactContent } from '~/queries/schema/schema-assistant-messages'import { VisualizationWidget, getArtifactOpenTarget } from 'products/posthog_ai/frontend/api/dataWidgets'+import { useQuillThread } from 'products/posthog_ai/frontend/api/primitives'import { MessageStatus } from '../maxLogic'@@ -62,6 +63,7 @@ export const VisualizationArtifact = React.memo(function VisualizationArtifact({}: VisualizationArtifactProps): JSX.Element | null {// Controlled collapse synced to edit mode — a key-remount would refetch the query instead.const [isCollapsed, setIsCollapsed] = useState(isEditingInsight)+ const quill = useQuillThread()useLayoutEffect(() => {setIsCollapsed(isEditingInsight)@@ -74,7 +76,7 @@ export const VisualizationArtifact = React.memo(function VisualizationArtifact({const target = getArtifactOpenTarget(message, content)const showSuggestionButton = isEditingInsight && activeSceneId === Scene.Insight- return (+ const widget = (<VisualizationWidgetcontent={content}openUrl={isEditingInsight ? null : target.url}@@ -84,4 +86,6 @@ export const VisualizationArtifact = React.memo(function VisualizationArtifact({extraActions={showSuggestionButton ? <InsightSuggestionButton /> : null}/>)+ // In the quill thread a chart card needs more room from the text around it than the row gap gives.+ return quill ? <div className="w-full my-2">{widget}</div> : widget})diff --git a/products/posthog_ai/frontend/components/quill/QuillWidgetCard.tsx b/products/posthog_ai/frontend/components/quill/QuillWidgetCard.tsxindex 52ac51e31c70..d720a28ea198 100644--- a/products/posthog_ai/frontend/components/quill/QuillWidgetCard.tsx+++ b/products/posthog_ai/frontend/components/quill/QuillWidgetCard.tsx@@ -5,7 +5,7 @@ import { quillCardBorderClass } from './quillCardBorder'export function QuillWidgetCard({ body, bodyHeightClassName, footer, danger = false }: WidgetCardProps): JSX.Element {return (- <Card size="sm" flush className={cn('py-0', quillCardBorderClass(danger))}>+ <Card size="sm" flush className={cn('w-full py-0', quillCardBorderClass(danger))}>{body && (// Product widgets keep PostHog's own colours inside the quill thread.<CardContent data-not-quill>