From ce49493bf857807114ea284cf7c0500f683af807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Oberm=C3=BCller?= Date: Tue, 6 Aug 2024 15:04:12 +0200 Subject: [PATCH] fix(insights): only show confirmation when navigating to new url (#24216) --- frontend/src/scenes/insights/insightSceneLogic.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/scenes/insights/insightSceneLogic.tsx b/frontend/src/scenes/insights/insightSceneLogic.tsx index 67634b200c7a4..ad5eff574651d 100644 --- a/frontend/src/scenes/insights/insightSceneLogic.tsx +++ b/frontend/src/scenes/insights/insightSceneLogic.tsx @@ -303,8 +303,10 @@ export const insightSceneLogic = kea([ return false } - // If just the hash changes, don't show the prompt - if (router.values.currentLocation.pathname === newLocation?.pathname) { + // If just the hash or project part changes, don't show the prompt + const currentPathname = router.values.currentLocation.pathname.replace(/\/project\/\d+/, '') + const newPathname = newLocation?.pathname.replace(/\/project\/\d+/, '') + if (currentPathname === newPathname) { return false }