: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
perf(dashboards): look up tile layouts from a map while rendering tiles (#123180)
Paul D'Ambra88850908d542
diff --git a/frontend/src/scenes/dashboard/DashboardItems.tsx b/frontend/src/scenes/dashboard/DashboardItems.tsxindex 1a0474629a2f..62f78deed1fa 100644--- a/frontend/src/scenes/dashboard/DashboardItems.tsx+++ b/frontend/src/scenes/dashboard/DashboardItems.tsx@@ -286,6 +286,7 @@ export function DashboardItems({ showCreateAnomalyAlertButton }: DashboardItemsPwidgetTilesShown,])+ const smLayoutsByTileId = useMemo(() => new Map((layouts['sm'] ?? []).map((l) => [l.i, l])), [layouts])const decorationsByTileId = useMemo(() =>new Map(@@ -570,9 +571,7 @@ export function DashboardItems({ showCreateAnomalyAlertButton }: DashboardItemsPconst renderTile = (tile: DashboardTile): JSX.Element | undefined => {const { insight, text, button_tile, widget } = tileconst tileActions = tileActionsById.get(tile.id)!- const smLayout = layouts['sm']?.find((l) => {- return l.i == tile.id.toString()- })+ const smLayout = smLayoutsByTileId.get(tile.id.toString())const decorations = decorationsByTileId.get(tile.id)