From a63c769ab6130dca079a7b0dde54de1d9c924284 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 26 May 2026 15:57:00 -0700 Subject: [PATCH 1/2] fix error messaging. --- .../websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx | 5 +++-- src/queries/sql/heatmap/ensureHeatmapSnapshot.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx index 01622e2a0..b71c8f438 100644 --- a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx +++ b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx @@ -5,6 +5,7 @@ import { LoadingPanel } from '@/components/common/LoadingPanel'; import { useResultQuery } from '@/components/hooks'; import { getClientAuthToken } from '@/lib/client'; import { formatLongNumber } from '@/lib/format'; +import { SNAPSHOT_UNAVAILABLE_ERROR } from '@/queries/sql/heatmap/ensureHeatmapSnapshot'; import type { HeatmapMode, HeatmapPoint, HeatmapResult, HeatmapSnapshot } from '@/queries/sql'; import styles from './Heatmap.module.css'; @@ -299,7 +300,7 @@ function ClickHeatmapView({ {showPage && snapshot?.status === 'failed' && ( - {snapshot.error || 'Page screenshot unavailable.'} + {SNAPSHOT_UNAVAILABLE_ERROR} )} @@ -447,7 +448,7 @@ function ScrollHeatmapView({ {showPage && snapshot?.status === 'failed' && ( - {snapshot.error || 'Page screenshot unavailable.'} + {SNAPSHOT_UNAVAILABLE_ERROR} )} diff --git a/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts b/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts index 62095c1a1..5b6ef71f0 100644 --- a/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts +++ b/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts @@ -13,6 +13,7 @@ const SNAPSHOT_STATUS = { const SNAPSHOT_RETRY_DELAY_MS = 15 * 60 * 1000; const SNAPSHOT_PENDING_WINDOW_MS = 30 * 1000; const SNAPSHOT_DEVICE_SCALE_FACTOR = 1; +export const SNAPSHOT_UNAVAILABLE_ERROR = 'Page screenshot unavailable.'; export type HeatmapSnapshotStatus = (typeof SNAPSHOT_STATUS)[keyof typeof SNAPSHOT_STATUS]; export interface HeatmapSnapshotImage { @@ -682,7 +683,7 @@ export async function ensureHeatmapSnapshot({ status: SNAPSHOT_STATUS.failed, mimeType: null, imageData: null, - error: 'Website domain is not configured for screenshot capture.', + error: SNAPSHOT_UNAVAILABLE_ERROR, }); const failed = await findSnapshot(websiteId, urlPath, viewportW, viewportH); @@ -741,7 +742,7 @@ export async function ensureHeatmapSnapshot({ status: SNAPSHOT_STATUS.failed, mimeType: null, imageData: null, - error: error instanceof Error ? error.message.slice(0, 500) : 'Screenshot capture failed.', + error: SNAPSHOT_UNAVAILABLE_ERROR, }); } From 7ac3f1eeccd905305dbd7804113ab79c0651907b Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Tue, 26 May 2026 16:00:46 -0700 Subject: [PATCH 2/2] fix export build errors --- .../(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx | 2 +- src/queries/sql/heatmap/ensureHeatmapSnapshot.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx index b71c8f438..c9f0a87e8 100644 --- a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx +++ b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx @@ -5,12 +5,12 @@ import { LoadingPanel } from '@/components/common/LoadingPanel'; import { useResultQuery } from '@/components/hooks'; import { getClientAuthToken } from '@/lib/client'; import { formatLongNumber } from '@/lib/format'; -import { SNAPSHOT_UNAVAILABLE_ERROR } from '@/queries/sql/heatmap/ensureHeatmapSnapshot'; import type { HeatmapMode, HeatmapPoint, HeatmapResult, HeatmapSnapshot } from '@/queries/sql'; import styles from './Heatmap.module.css'; const CLICK_EDGE_PERCENT = 1.5; const SCROLL_BUCKET_SIZE = 10; +const SNAPSHOT_UNAVAILABLE_ERROR = 'Page screenshot unavailable.'; interface ViewportBucket { width: number; diff --git a/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts b/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts index 5b6ef71f0..de5b02375 100644 --- a/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts +++ b/src/queries/sql/heatmap/ensureHeatmapSnapshot.ts @@ -13,7 +13,7 @@ const SNAPSHOT_STATUS = { const SNAPSHOT_RETRY_DELAY_MS = 15 * 60 * 1000; const SNAPSHOT_PENDING_WINDOW_MS = 30 * 1000; const SNAPSHOT_DEVICE_SCALE_FACTOR = 1; -export const SNAPSHOT_UNAVAILABLE_ERROR = 'Page screenshot unavailable.'; +const SNAPSHOT_UNAVAILABLE_ERROR = 'Page screenshot unavailable.'; export type HeatmapSnapshotStatus = (typeof SNAPSHOT_STATUS)[keyof typeof SNAPSHOT_STATUS]; export interface HeatmapSnapshotImage {