: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(heatmaps): make the generating story snapshot deterministic (#130138)
posthog[bot]0021793c80b0
diff --git a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.scss b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.scssnew file mode 100644index 000000000000..0bbfd9e2fb04--- /dev/null+++ b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.scss@@ -0,0 +1,23 @@+@keyframes HeatmapScene__hogWobble {+ from {+ transform: rotate(0deg);+ }++ to {+ transform: rotate(5deg);+ }+}++.HeatmapScene__hogWobble {+ transform-origin: 50% 50%;+ animation: HeatmapScene__hogWobble 1.2s ease-in-out infinite alternate;++ // With zeroed durations, CI can paint either end of the wobble, so the snapshot tilt changes between runs.+ .storybook-test-runner & {+ animation: none;+ }++ @media (prefers-reduced-motion: reduce) {+ animation: none;+ }+}diff --git a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.stories.tsx b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.stories.tsxindex eba1145b6891..1a2e3fb42fb4 100644--- a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.stories.tsx+++ b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.stories.tsx@@ -63,7 +63,9 @@ type Story = StoryObj<{}>export const Generating: Story = {parameters: {testOptions: {+ // The loading bar never goes away while generating, so wait for that state instead of the scene spinner.waitForLoadersToDisappear: false,+ waitForSelector: '[data-attr="heatmap-generating-screenshot"]',},},}diff --git a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsxindex 1c07627f0e3c..0f7728ccfa8c 100644--- a/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx+++ b/products/web_analytics/frontend/heatmaps/scenes/heatmap/HeatmapScene.tsx@@ -1,3 +1,5 @@+import './HeatmapScene.scss'+import { BindLogic, useActions, useAsyncActions, useValues } from 'kea'import { useRef } from 'react'import useResizeObserver from 'use-resize-observer'@@ -331,15 +333,8 @@ export function HeatmapScene({ id }: { id: string }): JSX.Element {className="flex-1 flex items-center justify-center min-h-96"data-attr="heatmap-generating-screenshot">- <style>{`@keyframes hog-wobble{from{transform:rotate(0deg)}to{transform:rotate(5deg)}}`}</style><div className="text-sm text-center font-semibold">- <HedgehogDirector- className="w-32 h-32 mx-auto mb-2"- style={{- animation: 'hog-wobble 1.2s ease-in-out infinite alternate',- transformOrigin: '50% 50%',- }}- />+ <HedgehogDirector className="HeatmapScene__hogWobble w-32 h-32 mx-auto mb-2" />Generating screenshot…<div className="text-muted text-xs mt-2">This usually takes a few minutes