From 54d46a1d034f00f46a0170b286cbf3d7ee14dec0 Mon Sep 17 00:00:00 2001 From: Aditya Singh Date: Wed, 16 Jul 2025 20:05:26 +0530 Subject: [PATCH] feat: minor refactor --- .../GridCardLayout/GridCard/FullView/index.tsx | 4 +++- .../GridCard/FullView/useDrilldown.tsx | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx b/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx index ebf565a080c0..5e2d9b7b618a 100644 --- a/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/FullView/index.tsx @@ -235,7 +235,9 @@ function FullView({ className="switch-edit-btn" disabled={response.isFetching || response.isLoading} onClick={(): void => { - safeNavigate(dashboardEditView); + if (dashboardEditView) { + safeNavigate(dashboardEditView); + } }} > Switch to Edit Mode diff --git a/frontend/src/container/GridCardLayout/GridCard/FullView/useDrilldown.tsx b/frontend/src/container/GridCardLayout/GridCard/FullView/useDrilldown.tsx index 532487ddcb18..ca7c6712b04c 100644 --- a/frontend/src/container/GridCardLayout/GridCard/FullView/useDrilldown.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/FullView/useDrilldown.tsx @@ -54,12 +54,14 @@ const useDrilldown = ({ isMounted.current = true; }, [widget, enableDrillDown, compositeQuery, redirectWithQueryBuilderData]); - const dashboardEditView = generateExportToDashboardLink({ - query: currentQuery, - panelType: widget.panelTypes, - dashboardId: selectedDashboard?.id || '', - widgetId: widget.id, - }); + const dashboardEditView = selectedDashboard?.id + ? generateExportToDashboardLink({ + query: currentQuery, + panelType: widget.panelTypes, + dashboardId: selectedDashboard?.id || '', + widgetId: widget.id, + }) + : ''; const showResetQuery = useMemo( () =>