Skip to content

fix(insights): align the loading skeleton with charts - #107952

Merged
trunk-io[bot] merged 6 commits into
masterfrom
posthog/improve-insight-loading-skeleton
Sep 29, 2026
Merged

trunk-io[bot] merged 6 commits into
masterfrom
posthog/improve-insight-loading-skeleton

Conversation

@MattPua

@MattPua MattPua commented Sep 28, 2026

Copy link
Copy Markdown
Member

Risk

Scale: 1/5 = trivial rollback, unlikely to hurt prod · 5/5 = data loss, security/tenant breach, or outage needing repair. Scores rollout danger, not diff size.

2/5 — The insight loading page can have a layout mismatch. A revert restores the previous placeholder.

Why this score

  • The change only affects the insight loading UI.
  • No API, migration, or persisted data change.
  • Existing chart skeleton code supplies the placeholder.

Verdict: Safe to merge after normal review.

Watch out for

  • Check that the loading page keeps its chart-sized placeholder during an insight fetch.

Problem

  • Insight users saw a generic skeleton that did not match the loaded chart page.

Changes

  • The loading state now reserves space for the insight header, actions, metadata, legend, and chart.
  • The shared visualization skeleton now defaults to a line chart when the query is not available.

How did you test this code?

  • Ran the frontend formatter.
  • Did not run the focused test. The local hogli command was unavailable.
  • Did not run a visual renderer. The user requested no Storybook or renderer work.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Release status

  • No feature flag controls this change
  • This change is behind a feature flag and is not available to users
  • This change makes a previously flagged feature available to everyone

Automatic notifications

  • Publish to changelog?

Docs update

  • None. This visual loading-state change has no matching documentation page.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: PostHog Desktop, GPT-5

  • Skills: writing-ui-components, writing-pr-descriptions, manage-prs, reviewing-with-coderabbit.
  • Open PR search found no duplicate.
  • CodeRabbit local review skipped because the CLI was unavailable.
  • No session material outside the repository appears in the commit or this description.

Created with PostHog Desktop

Generated-By: PostHog Desktop
Task-Id: 404cdcfb-f063-4d11-b9a4-9e5115e743fc
@MattPua MattPua added the stamphog Request AI approval (no full review) label Sep 28, 2026
@MattPua MattPua self-assigned this Sep 28, 2026
@trunk-io

trunk-io Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@MattPua
MattPua marked this pull request as ready for review September 28, 2026 19:14

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was skipped because it would exceed your organization's monthly flex usage limit. Raise the limit in billing settings or wait until the next billing period resets limits.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was skipped because it would exceed your organization's monthly flex usage limit. Raise the limit in billing settings or wait until the next billing period resets limits.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ✅ ready

▶ Open the preview

🔑 Login test@posthog.com / 12345678 (demo data)
🧩 Running this PR's backend and frontend, on the PostHog :master base
🔗 Link stable across rebuilds — a re-push swaps the box underneath, the URL stays
🔒 Access tailnet only (PostHog VPN)
🛠️ Admin inspect & debug state in hogland
💤 Idle sleeps after ~30 min idle (snapshot to S3, zero node cost) and wakes on your next visit in ~30s, behind a brief "waking up" screen

commit e28c160 · box box-c8476d30e25a · ready in 717s (push → usable) · build log · rebuilds on every push, torn down on close

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team September 28, 2026 19:15
stamphog[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

⚠️ Complexity (TypeScript) — 1 function above the limit (max 12)

Cyclomatic complexity above the limit in changed typescript files (10 for production files, 15 for test files). Warn only: worth simplifying when you next touch these functions.

Function Location Complexity Limit
InsightVisualizationSkeleton frontend/src/lib/components/Cards/InsightCard/InsightVisualizationSkeleton.tsx:9 12 10
✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Bundle size — 🔺 +958 B (+0.0%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 68.96 MiB · 🔺 +958 B (+0.0%)

No file changed by more than 1000 B.

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

✅ Eager graph — within budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.58 MiB · 22 files 🔺 +94 B (+0.0%) █████████░ 85.8% of 1.84 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
3.52 MiB · 629 files 🔺 +94 B (+0.0%) █████████░ 87.4% of 4.03 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.35 MiB · 2,339 files 🔺 +94 B (+0.0%) █████████░ 88.1% of 8.34 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/layout/navigation-3000/navigationLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/dashboard/dashboardLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/lemon-ui/LemonMarkdown/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/RichContentEditor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/CodeSnippet/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/taxonomy/core-filter-definitions-by-group.json stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.5 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
3.9 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.4 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.3 KiB src/index.tsx
1.3 KiB src/RootErrorBoundary.tsx
912 B ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
854 B src/scenes/ChunkLoadErrorBoundary.tsx
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
301.8 KiB ../node_modules/.pnpm/posthog-js@1.434.14_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
216.9 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
100.5 KiB src/lib/api.ts
88.5 KiB src/products.tsx
69.4 KiB src/lib/lemon-ui/icons/icons.tsx
40.1 KiB src/lib/utils/eventUsageLogic.ts
38.7 KiB ../node_modules/.pnpm/@dnd-kit+core@6.0.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
33.9 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
28.4 KiB src/scenes/scenes.ts
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
301.8 KiB ../node_modules/.pnpm/posthog-js@1.434.14_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
272.3 KiB src/taxonomy/core-filter-definitions-by-group.json
216.9 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.7 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
100.5 KiB src/lib/api.ts
98.8 KiB ../packages/quill/packages/quill/dist/index.js
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
90.6 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
88.5 KiB src/products.tsx

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

✅ Toolbar bundle — eager 2.16 MiB within budget

What the toolbar ships to customer pages, measured from the esbuild output (minified, post-tree-shake). The eager set is the entry plus everything statically imported from it — fetched before any feature runs; deferred chunks load lazily. The eager guardrail is 5.72 MiB. Each output file must also stay below 10 MB, where CloudFront stops compressing it. The module boundary is enforced separately by check-toolbar-graph.

Metric Size Δ vs base Budget
Eager (shipped)
entry + static imports
2.16 MiB · 19 files 🔺 +94 B (+0.0%) ████░░░░░░ 37.8% of 5.72 MiB
Deferred (lazy) 2.10 MiB · 44 files no change n/a — loads on demand
Loader dist/toolbar.js 1.2 KiB no change █░░░░░░░░░ 6.0% of 19.5 KiB
Largest eagerly-shipped chunks
Size File
805.4 KiB dist/toolbar/toolbar-app-L4W3BY7V.css
651.7 KiB dist/toolbar/chunk-chunk-N5H2P45W.js
259.4 KiB dist/toolbar/chunk-chunk-UFQG5EMJ.js
138.3 KiB dist/toolbar/chunk-chunk-6OY66GIY.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
75.2 KiB dist/toolbar/toolbar-app-VY4JKXM4.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-MAVTJURD.js
21.0 KiB dist/toolbar/chunk-chunk-JBZQMGNO.js
6.8 KiB dist/toolbar/chunk-chunk-DV7IWQNF.js

Posted automatically by check-toolbar-size · sizes are toolbar output bytes (shipped, post-tree-shake) from the esbuild metafile

✅ Dist folder size — 🔺 +7.2 KiB (+0.0%)

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 947.68 MiB · 🔺 +7.2 KiB (+0.0%)

✅ Playwright — all passed

All tests passed.

View test results →

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: PostHog/posthog/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 6faed2d2-8d65-4ef6-a1a5-14d9f6b43ba2

📥 Commits

Reviewing files that changed from the base of the PR and between 0a37d54 and e74525d.

📒 Files selected for processing (1)
  • frontend/snapshots.yml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

InsightSkeleton replaces generic placeholders with a page-shaped skeleton that includes header, description, legend, and visualization placeholders. Its root uses the scene-content layout and sets aria-busy="true". InsightVisualizationSkeleton now accepts an optional query and uses the line shape when the query is absent. Snapshot hashes changed for narrow dark and light variants.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e7452

The insight loading state now uses a structured placeholder, while query-specific chart shapes remain available where a query is supplied. No concrete regression is established, so merge risk is minimal.

Architecture Summary

Architecture risk: 🔵 Low · up to e7452

The change affects 1 system.

Changed systems: frontend

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — frontend (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in frontend/src/lib/components/Cards/InsightCard/InsightVisualizationSkeleton.tsx: InsightVisualizationSkeleton makes query optional and defaults to the line shape when it is absent; when provided, the shape is still derived from query.
  • observed — Modified behavior in frontend/src/scenes/insights/InsightSkeleton.tsx: InsightSkeleton replaces the generic text and two-column panel placeholders with a page-shaped skeleton containing header and action placeholders, description lines, legend items, and an InsightVisualizationSkeleton. The root is now a scene-content container marked aria-busy="true".
  • observed — Modified behavior in frontend/snapshots.yml: Updated the hashes for the narrow dark and narrow light snapshots; the previous hash values were replaced.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the problem, user-visible changes, testing limits, release status, docs status, and agent context. It honestly states that focused tests and visual rendering were not run. A fro…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@trunk-io

trunk-io Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@posthog

posthog Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🕓 This approval covered an earlier revision. There are new visual changes to review in the newer comment below.

✅ Visual changes approved by @MattPua — baseline updated in 541869b.

View this run in PostHog

2 changed.

Install the Visual Review Chrome extension to see visual review results at the top of your pull requests.

2 updated
Run: c2772628-eabc-433e-b184-975918be134a

Co-authored-by: MattPua <3376526+MattPua@users.noreply.github.com>
@stamphog
stamphog Bot dismissed their stale review September 28, 2026 20:11

A new stamphog review started for this PR — the fresh verdict replaces this approval.

stamphog[bot]

This comment was marked as outdated.

@stamphog
stamphog Bot dismissed their stale review September 29, 2026 15:41

A new stamphog review started for this PR — the fresh verdict replaces this approval.

stamphog[bot]

This comment was marked as outdated.

@stamphog
stamphog Bot dismissed their stale review September 29, 2026 16:28

A new stamphog review started for this PR — the fresh verdict replaces this approval.

stamphog[bot]

This comment was marked as outdated.

@posthog

posthog Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ Visual changes approved by @MattPua — baseline updated in e28c160.

View this run in PostHog

2 changed, 2 removed.

Install the Visual Review Chrome extension to see visual review results at the top of your pull requests.

2 updated, 2 removed
Run: 20678a23-f54b-414b-9830-ce821974b0d1

Co-authored-by: MattPua <3376526+MattPua@users.noreply.github.com>
@stamphog
stamphog Bot dismissed their stale review September 29, 2026 16:55

A new stamphog review started for this PR — the fresh verdict replaces this approval.

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Contained, reversible frontend loading-skeleton change outside risky territory. The import alias is already used elsewhere, and the author is on the owning team.

  • Author wrote 10% of the modified lines and has 96 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 53L, 3F substantive — within ceiling
tier ✓ T1-agent / T1b-small (53L, 3F, single-area, fix)
stamphog 2.3.1 .stamphog/policy.yml @ e28c160 · reviewed head e28c160

@trunk-io
trunk-io Bot merged commit cbf0c3d into master Sep 29, 2026
219 checks passed
@trunk-io
trunk-io Bot deleted the posthog/improve-insight-loading-skeleton branch September 29, 2026 17:24
@deployment-status-posthog

deployment-status-posthog Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-29 18:01 UTC Run
prod-us ✅ Deployed 2026-09-29 18:11 UTC Run
prod-eu ✅ Deployed 2026-09-29 18:12 UTC Run

This branch was successfully deployed

1 active deployment
preview-pr-107952 — e28c1601 Deployed Sep 29, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant