From 97a3e432f62d57a185323a08b64f3c80b6334403 Mon Sep 17 00:00:00 2001 From: Matt Pua Date: Thu, 26 Nov 2026 09:56:45 -0500 Subject: [PATCH 1/2] feat(dashboards): show icons instead of hedgehogs for v2 error states Co-Authored-By: Claude Opus 5.5 --- .../dashboard/DashboardUnavailable.tsx | 22 ++++++++-- .../frontend/widgets/core/WidgetView.tsx | 41 +++++++------------ 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/products/dashboards_v2/frontend/dashboard/DashboardUnavailable.tsx b/products/dashboards_v2/frontend/dashboard/DashboardUnavailable.tsx index 3641f4c907653..53493b2ff8b16 100644 --- a/products/dashboards_v2/frontend/dashboard/DashboardUnavailable.tsx +++ b/products/dashboards_v2/frontend/dashboard/DashboardUnavailable.tsx @@ -1,16 +1,24 @@ import clsx from 'clsx' import type { ReactNode } from 'react' -import * as errorHoggie from '@posthog/brand/hoggies/png/error' import * as magnifyingGlass from '@posthog/brand/hoggies/png/magnifying-glass' import * as stampDenied from '@posthog/brand/hoggies/png/stamp-denied' -import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@posthog/quill' +import { IconWarning } from '@posthog/icons' +import { + Empty, + EmptyContent, + EmptyDescription, + EmptyHeader, + EmptyMedia, + EmptyTitle, + IconStack, + IconStackItem, +} from '@posthog/quill' import { pngHoggie } from 'lib/brand/hoggies' const HedgehogSearching = pngHoggie(magnifyingGlass) const HedgehogDenied = pngHoggie(stampDenied) -const HedgehogError = pngHoggie(errorHoggie) export type UnavailableReason = 'notFound' | 'noAccess' | 'error' @@ -32,7 +40,13 @@ const DEFAULT_VIEWS: Record = { description: 'Ask the dashboard owner or a project admin to give you access.', }, error: { - illustration: , + illustration: ( + + + + + + ), title: "This dashboard couldn't be shown", description: 'Refresh the page, and if it keeps happening contact support.', }, diff --git a/products/dashboards_v2/frontend/widgets/core/WidgetView.tsx b/products/dashboards_v2/frontend/widgets/core/WidgetView.tsx index 2676a2544c01d..12cccfdd719f1 100644 --- a/products/dashboards_v2/frontend/widgets/core/WidgetView.tsx +++ b/products/dashboards_v2/frontend/widgets/core/WidgetView.tsx @@ -1,14 +1,8 @@ import { type ComponentType, Suspense, memo, useContext, useLayoutEffect } from 'react' -import * as constructionHoggie from '@posthog/brand/hoggies/png/construction-1' -import * as errorHoggie from '@posthog/brand/hoggies/png/error' -import * as panicHoggie from '@posthog/brand/hoggies/png/panic' -import * as puzzleHoggie from '@posthog/brand/hoggies/png/puzzle' -import { IconLineGraph } from '@posthog/icons' +import { IconLineGraph, IconPuzzle, IconWarning, IconWrench } from '@posthog/icons' import { Empty, EmptyDescription, EmptyHeader, EmptyTitle, IconStack, IconStackItem, Skeleton } from '@posthog/quill' -import { pngHoggie } from 'lib/brand/hoggies' - import type { SavedWidget } from '../../dashboard/document/dashboardTypes' import type { WidgetType } from './widgetDefinition' import { WidgetErrorBoundary } from './WidgetErrorBoundary' @@ -21,29 +15,24 @@ function HoldsLoad(): null { return null } -const HedgehogError = pngHoggie(errorHoggie) -const HedgehogPuzzle = pngHoggie(puzzleHoggie) -const HedgehogConstruction = pngHoggie(constructionHoggie) -const HedgehogPanic = pngHoggie(panicHoggie) - -/** Why a widget shows a message instead of its content. A problem gets a hedgehog, and an empty result an icon. */ +/** Why a widget shows a message instead of its content. */ export type WidgetProblem = 'error' | 'unknownType' | 'invalidSettings' | 'failedQuery' | 'empty' -const HOGGIE_CLASS = 'size-10 shrink-0 object-contain @min-[20rem]:size-16' - -// The empty icon matches the quill empty state on v1 insights, so an empty chart reads the same on both dashboards. -const ILLUSTRATIONS: Record = { - error: , - unknownType: , - invalidSettings: , - failedQuery: , - empty: ( +function ProblemIcon({ icon, color }: { icon: JSX.Element; color: string }): JSX.Element { + return ( - - - + {icon} - ), + ) +} + +// Icons and colors match the quill states on v1 insights, so a tile reads the same on both dashboards. +const ILLUSTRATIONS: Record = { + error: } color="var(--destructive-foreground)" />, + unknownType: } color="var(--warning-foreground)" />, + invalidSettings: } color="var(--warning-foreground)" />, + failedQuery: } color="var(--destructive-foreground)" />, + empty: } color="var(--color-product-product-analytics-light)" />, } const LINE_WIDTHS = ['w-3/4', 'w-full', 'w-5/6', 'w-2/3'] From 1af921facb9e37623c8525711e789a0c645e9f5d Mon Sep 17 00:00:00 2001 From: Matt Pua Date: Thu, 26 Nov 2026 11:30:23 -0500 Subject: [PATCH 2/2] fix(dashboards): pass v2 chunk-load errors up to the app's recovery boundary Co-Authored-By: Claude Opus 5.5 --- .../frontend/dashboard/DashboardErrorBoundary.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/products/dashboards_v2/frontend/dashboard/DashboardErrorBoundary.tsx b/products/dashboards_v2/frontend/dashboard/DashboardErrorBoundary.tsx index 8381e42aa4718..b4c910e90b4f8 100644 --- a/products/dashboards_v2/frontend/dashboard/DashboardErrorBoundary.tsx +++ b/products/dashboards_v2/frontend/dashboard/DashboardErrorBoundary.tsx @@ -1,11 +1,14 @@ import posthog from 'posthog-js' import { Component, type ErrorInfo, type ReactNode } from 'react' +import { isChunkLoadError } from 'lib/utils/isChunkLoadError' + import { DashboardUnavailable } from './DashboardUnavailable' import type { Dashboard } from './document/dashboardTypes' type DashboardErrorState = { failed: boolean + error?: unknown dashboard: Dashboard } @@ -24,15 +27,22 @@ export class DashboardErrorBoundary extends Component< return props.dashboard === state.dashboard ? null : { failed: false, dashboard: props.dashboard } } - static getDerivedStateFromError(): Partial { - return { failed: true } + static getDerivedStateFromError(error: unknown): Partial { + return { failed: true, error } } override componentDidCatch(error: Error, info: ErrorInfo): void { + if (isChunkLoadError(error)) { + return + } posthog.captureException(error, { tag: 'dashboards-v2-dashboard', componentStack: info.componentStack }) } override render(): ReactNode { + // A widget's failed code download goes on up to the app's chunk boundary, which reloads the page. + if (this.state.failed && isChunkLoadError(this.state.error)) { + throw this.state.error + } return this.state.failed ? : this.props.children } }