From 233f119037ffbf5f48376291991cfcaaa5ff9daa Mon Sep 17 00:00:00 2001 From: Ivan Ortega Alba <ivanortegaalba@gmail.com> Date: Thu, 28 Mar 2024 16:39:18 +0100 Subject: [PATCH] Panel: Description display event is reported multiple times (#85283) --- .../serialization/transformSaveModelToScene.ts | 17 ----------------- .../dashboard-scene/utils/interactions.ts | 3 --- .../dashboard/utils/getPanelChromeProps.tsx | 8 -------- 3 files changed, 28 deletions(-) diff --git a/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts b/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts index b92c7a847dc..9eb8c824c08 100644 --- a/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts +++ b/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.ts @@ -540,18 +540,6 @@ export function buildGridItemForPanel(panel: PanelModel): DashboardGridItem { }); } -const getLimitedDescriptionReporter = () => { - const reportedPanels: string[] = []; - - return (key: string) => { - if (reportedPanels.includes(key)) { - return; - } - reportedPanels.push(key); - DashboardInteractions.panelDescriptionShown(); - }; -}; - function registerDashboardSceneTracking(model: DashboardModel) { return () => { const unsetDashboardInteractionsScenesContext = DashboardInteractions.setScenesContext(); @@ -565,15 +553,10 @@ function registerDashboardSceneTracking(model: DashboardModel) { } function registerPanelInteractionsReporter(scene: DashboardScene) { - const descriptionReporter = getLimitedDescriptionReporter(); - // Subscriptions set with subscribeToEvent are automatically unsubscribed when the scene deactivated scene.subscribeToEvent(UserActionEvent, (e) => { const { interaction } = e.payload; switch (interaction) { - case 'panel-description-shown': - descriptionReporter(e.payload.origin.state.key || ''); - break; case 'panel-status-message-clicked': DashboardInteractions.panelStatusMessageClicked(); break; diff --git a/public/app/features/dashboard-scene/utils/interactions.ts b/public/app/features/dashboard-scene/utils/interactions.ts index a4da3b1b0be..4f45bc7b457 100644 --- a/public/app/features/dashboard-scene/utils/interactions.ts +++ b/public/app/features/dashboard-scene/utils/interactions.ts @@ -41,9 +41,6 @@ export const DashboardInteractions = { panelCancelQueryClicked: (properties?: Record<string, unknown>) => { reportDashboardInteraction('panelheader_cancelquery_clicked', properties); }, - panelDescriptionShown: (properties?: Record<string, unknown>) => { - reportDashboardInteraction('panelheader_description_displayed', properties); - }, // Sharing interactions: sharingTabChanged: (properties?: Record<string, unknown>) => { diff --git a/public/app/features/dashboard/utils/getPanelChromeProps.tsx b/public/app/features/dashboard/utils/getPanelChromeProps.tsx index 73209b86536..926a307203c 100644 --- a/public/app/features/dashboard/utils/getPanelChromeProps.tsx +++ b/public/app/features/dashboard/utils/getPanelChromeProps.tsx @@ -26,8 +26,6 @@ interface CommonProps { } export function getPanelChromeProps(props: CommonProps) { - let descriptionInteractionReported = false; - function hasOverlayHeader() { // always show normal header if we have time override if (props.data.request && props.data.request.timeInfo) { @@ -41,12 +39,6 @@ export function getPanelChromeProps(props: CommonProps) { const descriptionMarkdown = getTemplateSrv().replace(props.panel.description, props.panel.scopedVars); const interpolatedDescription = renderMarkdown(descriptionMarkdown); - if (!descriptionInteractionReported) { - // Description rendering function can be called multiple times due to re-renders but we want to report the interaction once. - DashboardInteractions.panelDescriptionShown(); - descriptionInteractionReported = true; - } - return interpolatedDescription; };