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(web-analytics): Fix heatmap height clipping (#71688)

Jordan Mryyan8617e57520fb
diff --git a/frontend/src/exporter/scenes/ExporterHeatmapScene.tsx b/frontend/src/exporter/scenes/ExporterHeatmapScene.tsx
index 683ce532842e..ca740db24ef7 100644
--- a/frontend/src/exporter/scenes/ExporterHeatmapScene.tsx
+++ b/frontend/src/exporter/scenes/ExporterHeatmapScene.tsx
@@ -1,6 +1,7 @@
import { useValues } from 'kea'
import { HeatmapCanvas } from 'lib/components/heatmaps/HeatmapCanvas'
+import { heatmapDataLogic } from 'lib/components/heatmaps/heatmapDataLogic'
import { exporterViewLogic } from '../exporterViewLogic'
@@ -9,14 +10,15 @@ export default function ExporterHeatmapScene(): JSX.Element {
const { exportToken } = exportedData
const width = exportedData.heatmap_context?.width
+ const { heightOverride } = useValues(heatmapDataLogic({ context: 'in-app', exportToken }))
+
return (
<div
className="heatmap-exporter relative"
// eslint-disable-next-line react/forbid-dom-props
style={{
width: width ? `${width}px` : '100%',
- minHeight: '100vh',
- overflow: 'hidden',
+ height: `${heightOverride}px`,
}}
>
<HeatmapCanvas
@@ -40,7 +42,7 @@ export default function ExporterHeatmapScene(): JSX.Element {
title="Heatmap export"
className="bg-white"
// eslint-disable-next-line react/forbid-dom-props
- style={{ width: '100%', height: '100vh', display: 'block' }}
+ style={{ width: '100%', height: `${heightOverride}px`, display: 'block' }}
src={exportedData.heatmap_url ?? ''}
// these two sandbox values are necessary so that the site and toolbar can run
// this is a very loose sandbox,
diff --git a/frontend/src/lib/components/heatmaps/HeatmapCanvas.tsx b/frontend/src/lib/components/heatmaps/HeatmapCanvas.tsx
index 5b3cb1a1c800..e66344c72b3e 100644
--- a/frontend/src/lib/components/heatmaps/HeatmapCanvas.tsx
+++ b/frontend/src/lib/components/heatmaps/HeatmapCanvas.tsx
@@ -257,7 +257,7 @@ export function HeatmapCanvas({
<div
key={
exportToken
- ? 'export-heatmap'
+ ? `export-heatmap-${widthOverride ?? windowWidth}x${heightOverride}x${heatmapFixedPositionMode}`
: `${widthOverride ?? windowWidth}x${windowHeight}x${heightOverride}x${heatmapFixedPositionMode}`
}
className={cn('absolute inset-0', loadingClass)}
diff --git a/frontend/src/scenes/heatmaps/components/HeatmapsBrowser.tsx b/frontend/src/scenes/heatmaps/components/HeatmapsBrowser.tsx
index d830dd9e9b49..fd3240fe834b 100644
--- a/frontend/src/scenes/heatmaps/components/HeatmapsBrowser.tsx
+++ b/frontend/src/scenes/heatmaps/components/HeatmapsBrowser.tsx
@@ -39,11 +39,11 @@ function ExportButton({
const { dataUrl } = useValues(logic)
const { startHeatmapExport } = useActions(exportsLogic)
- const { heatmapFilters, heatmapColorPalette, heatmapFixedPositionMode, commonFilters } = useValues(
+ const { heatmapFilters, heatmapColorPalette, heatmapFixedPositionMode, commonFilters, heightOverride } = useValues(
heatmapDataLogic({ context: 'in-app' })
)
- const { width: iframeWidth, height: iframeHeight } = useResizeObserver<HTMLIFrameElement>({ ref: iframeRef })
+ const { width: iframeWidth } = useResizeObserver<HTMLIFrameElement>({ ref: iframeRef })
// Creating an export requires editor access to the export resource.
const exportAccessControlDisabledReason = getAccessControlDisabledReason(
@@ -56,7 +56,7 @@ function ExportButton({
startHeatmapExport({
heatmap_url: dataUrl,
width: iframeWidth,
- height: iframeHeight,
+ height: heightOverride,
heatmap_color_palette: heatmapColorPalette,
heatmap_fixed_position_mode: heatmapFixedPositionMode,
common_filters: commonFilters,
diff --git a/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts b/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts
index 5ad6476711ff..c25cff91297a 100644
--- a/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts
+++ b/frontend/src/scenes/heatmaps/scenes/heatmap/heatmapLogic.ts
@@ -507,6 +507,7 @@ export const heatmapLogic = kea<heatmapLogicType>([
heatmap_data_url: values.dataUrl ?? '',
heatmap_type: values.type,
width: values.widthOverride,
+ height: values.heightOverride,
heatmap_color_palette: values.heatmapColorPalette,
heatmap_fixed_position_mode: values.heatmapFixedPositionMode,
common_filters: values.commonFilters,
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index eac34e328d3e..b48df20481d9 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -5602,6 +5602,7 @@ export interface HeatmapExportContext {
heatmap_fixed_position_mode?: HeatmapFixedPositionMode
common_filters?: CommonFilters
width?: number
+ height?: number
}
export type ExportContext = (