Skip to content

: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.

fix(workflows): wait for monaco before snapshotting reference input (#100600)

Paul D'Ambra9c6bcae0b7ad
diff --git a/frontend/src/lib/components/HogQLEditor/HogQLEditor.stories.tsx b/frontend/src/lib/components/HogQLEditor/HogQLEditor.stories.tsx
index 0f4c3f6325b6..d2ced97d772c 100644
--- a/frontend/src/lib/components/HogQLEditor/HogQLEditor.stories.tsx
+++ b/frontend/src/lib/components/HogQLEditor/HogQLEditor.stories.tsx
@@ -11,6 +11,14 @@ const meta: Meta<HogQLEditorProps> = {
const [value, onChange] = useState(props.value ?? "countIf(properties.$browser = 'Chrome')")
return <HogQLEditor {...props} value={value} onChange={onChange} />
},
+ parameters: {
+ // Every story renders Monaco unconditionally. Monaco loads through a lazy Suspense
+ // facade, so without this the snapshot can be taken before or after it finishes
+ // mounting, producing two different layouts for the same code.
+ testOptions: {
+ waitForSelector: '.monaco-editor',
+ },
+ },
}
export default meta
diff --git a/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateModal.stories.tsx b/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateModal.stories.tsx
index 96f3b18dc028..abee1ca76065 100644
--- a/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateModal.stories.tsx
+++ b/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateModal.stories.tsx
@@ -193,6 +193,13 @@ export const FullJsonEditor: StoryObj<ViewerModeStoryArgs> = {
args: {
viewerMode: 'staff',
},
+ // Default args render the Monaco JSON editor, which loads through a lazy Suspense facade -
+ // wait for it to mount rather than racing its load, the same as SQLEditorScene.stories.tsx.
+ parameters: {
+ testOptions: {
+ waitForSelector: '.monaco-editor',
+ },
+ },
argTypes: {
viewerMode: {
control: 'inline-radio',
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/CustomerTaskWorkflowReferenceInput.stories.tsx b/products/workflows/frontend/Workflows/hogflows/steps/components/CustomerTaskWorkflowReferenceInput.stories.tsx
index e8ea557c1b64..4dc851412399 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/components/CustomerTaskWorkflowReferenceInput.stories.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/CustomerTaskWorkflowReferenceInput.stories.tsx
@@ -19,6 +19,10 @@ const meta: Meta<typeof CustomerTaskWorkflowReferenceInput> = {
},
},
},
+ // Wait for Monaco to mount so raw-mode stories have a stable snapshot layout.
+ testOptions: {
+ waitForSelector: '.monaco-editor',
+ },
},
}
export default meta