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.

perf(dashboards): keep resized tile tracking the cursor (#66097)

Matt Pua82f9eca51d02
diff --git a/frontend/src/scenes/dashboard/DashboardItems.scss b/frontend/src/scenes/dashboard/DashboardItems.scss
index b8b0d5c44d18..12c9669d0de5 100644
--- a/frontend/src/scenes/dashboard/DashboardItems.scss
+++ b/frontend/src/scenes/dashboard/DashboardItems.scss
@@ -31,6 +31,9 @@
.react-grid-item.resizing {
z-index: 1;
+
+ // Snap to the pointer — without this the cssTransforms transition eases the move and the tile trails the cursor.
+ transition: none;
will-change: width, height;
}
diff --git a/frontend/src/scenes/dashboard/DashboardItems.tsx b/frontend/src/scenes/dashboard/DashboardItems.tsx
index 8104c4194e77..cd3c999daaf0 100644
--- a/frontend/src/scenes/dashboard/DashboardItems.tsx
+++ b/frontend/src/scenes/dashboard/DashboardItems.tsx
@@ -163,6 +163,11 @@ export function DashboardItems(): JSX.Element {
const element = containerRef.current
const observer = new ResizeObserver((entries) => {
+ // Skip per-frame height commits during a gesture — they re-render every tile just for GridBackground,
+ // lagging the cursor. flushPendingLayouts remeasures on stop.
+ if (interactionInProgress.current) {
+ return
+ }
for (const entry of entries) {
if (entry.target === element) {
setContainerHeight(entry.contentRect.height)
@@ -295,6 +300,12 @@ export function DashboardItems(): JSX.Element {
updateLayouts(pendingLayouts.current)
pendingLayouts.current = null
}
+ // Remeasure once the gesture settles, since height updates were suppressed during it.
+ requestAnimationFrame(() => {
+ if (containerRef.current) {
+ setContainerHeight(containerRef.current.clientHeight)
+ }
+ })
}, [updateLayouts])
const handleWidthChange = useCallback(