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(insights): align the loading skeleton with charts (#107952)

Matt Puacbf0c3d7ec8a
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 2126be30f007..7b402d4d9c0e 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5424,10 +5424,6 @@ snapshots:
hash: v1.k794b7964.62481a20890d8d9702570d58b69f47580c91399daa635cab23d9e8da75d2636f.4zz_BsbTTGbjpB2UW_cLkBiMwGDI54MGoQlD9_b9hV8
lemon-ui-object-tags--default--light:
hash: v1.k794b7964.1a69b09d2bc7612599daf0a1228b103250debc4afa2224fb8005e3c9b7f63326.bYCI4pCGFv3tFdGcQfIkfzDcOnpuLhD10S33l9BYIYg
- lemon-ui-object-tags--editable-tags-in-narrow-container--dark:
- hash: v1.k794b7964.6538590671c5bcd8feb77e0400c8532705932f4f55856dd6a99a6abcdc00b6e3.ca3qOKbmxmRDrNfdNRCEg9I9Wvnkrs7PHzA0tvpXTIM
- lemon-ui-object-tags--editable-tags-in-narrow-container--light:
- hash: v1.k794b7964.8b8f244a4387d0d1165067851b5758f5ad5429fae2b4a4e87eb7c53cdfdd4e18.MekQJYDe11n-5XnhJV5phxqMh5OqTw36CTFCk_BZNnw
lemon-ui-object-tags--static-only--dark:
hash: v1.k794b7964.62481a20890d8d9702570d58b69f47580c91399daa635cab23d9e8da75d2636f.oAaWHdceTRTQOchqDXvZ7-ym0DB_CpRpPyXnqlKugwo
lemon-ui-object-tags--static-only--light:
diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightVisualizationSkeleton.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightVisualizationSkeleton.tsx
index 93b65b203952..54abcd0485d0 100644
--- a/frontend/src/lib/components/Cards/InsightCard/InsightVisualizationSkeleton.tsx
+++ b/frontend/src/lib/components/Cards/InsightCard/InsightVisualizationSkeleton.tsx
@@ -6,8 +6,8 @@ import { visualizationShape } from './visualizationShape'
const BAR_HEIGHTS = ['h-2/5', 'h-3/5', 'h-1/2', 'h-4/5', 'h-2/3', 'h-3/4', 'h-1/3', 'h-3/5']
const FUNNEL_WIDTHS = ['w-full', 'w-4/5', 'w-3/5', 'w-2/5']
-export function InsightVisualizationSkeleton({ query }: { query: InsightModel['query'] }): JSX.Element {
- const shape = visualizationShape(query)
+export function InsightVisualizationSkeleton({ query }: { query?: InsightModel['query'] }): JSX.Element {
+ const shape = query ? visualizationShape(query) : 'line'
let chart: JSX.Element
if (shape === 'number') {
diff --git a/frontend/src/scenes/insights/InsightSkeleton.tsx b/frontend/src/scenes/insights/InsightSkeleton.tsx
index b64124812b77..c7496fe99021 100644
--- a/frontend/src/scenes/insights/InsightSkeleton.tsx
+++ b/frontend/src/scenes/insights/InsightSkeleton.tsx
@@ -1,23 +1,40 @@
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
+import { InsightVisualizationSkeleton } from '~/lib/components/Cards/InsightCard/InsightVisualizationSkeleton'
+
export function InsightSkeleton(): JSX.Element {
return (
- <>
- <div className="my-6 deprecated-space-y-4">
- <LemonSkeleton className="w-1/4 h-4" />
- <LemonSkeleton className="w-1/2 h-4" repeat={3} />
- <LemonSkeleton />
- <div className="border rounded p-6 flex items-center gap-4">
- <div className="flex-1 deprecated-space-y-2">
- <LemonSkeleton.Row repeat={3} />
- </div>
+ <div className="scene-content flex flex-col gap-y-4 relative z-10" aria-busy="true">
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <div className="flex min-w-0 items-center gap-2">
+ <LemonSkeleton className="size-8 shrink-0" />
+ <LemonSkeleton className="h-6 w-64 max-w-full" />
+ </div>
+
+ <div className="flex flex-wrap gap-2">
+ <LemonSkeleton className="h-8 w-32" />
+ <LemonSkeleton className="h-8 w-24" />
+ <LemonSkeleton className="h-8 w-14" />
+ </div>
+ </div>
+
+ <div className="deprecated-space-y-2">
+ <LemonSkeleton className="h-4 w-3/4 max-w-full" />
+ <LemonSkeleton className="h-4 w-1/2 max-w-full" />
+ <LemonSkeleton className="h-3 w-64 max-w-full" />
+ </div>
- <div className="flex-1 deprecated-space-y-2">
- <LemonSkeleton.Row repeat={3} />
- </div>
+ <div className="rounded border bg-primary p-4">
+ <div className="mb-4 flex flex-wrap justify-center gap-x-4 gap-y-2">
+ <LemonSkeleton className="h-3 w-28" />
+ <LemonSkeleton className="h-3 w-24" />
+ <LemonSkeleton className="h-3 w-28" />
+ <LemonSkeleton className="h-3 w-24" />
+ </div>
+ <div className="InsightVizDisplay min-h-[var(--insight-viz-min-height)]">
+ <InsightVisualizationSkeleton />
</div>
- <div className="border rounded p-6 min-h-100" />
</div>
- </>
+ </div>
)
}