From 58eb0ec9543c073a14043e28a686af7fb76959db Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Thu, 17 Jul 2025 15:07:56 +0200 Subject: [PATCH] Analytics: Fix depth calculation when reporting new folder creation (#108231) Fix depth calculation --- .../features/browse-dashboards/components/CreateNewButton.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/browse-dashboards/components/CreateNewButton.tsx b/public/app/features/browse-dashboards/components/CreateNewButton.tsx index d1c487da4f8..027916de85e 100644 --- a/public/app/features/browse-dashboards/components/CreateNewButton.tsx +++ b/public/app/features/browse-dashboards/components/CreateNewButton.tsx @@ -41,7 +41,7 @@ export default function CreateNewButton({ parentFolder, canCreateDashboard, canC parentUid: parentFolder?.uid, }); - const depth = parentFolder?.parents ? parentFolder.parents.length + 1 : 0; + const depth = parentFolder ? (parentFolder.parents?.length || 0) + 1 : 0; reportInteraction('grafana_manage_dashboards_folder_created', { is_subfolder: Boolean(parentFolder?.uid), folder_depth: depth,