Skip to content

Commit

Permalink
Ensure table row view is closed when we navigate to a different dashb…
Browse files Browse the repository at this point in the history
…oard #631
  • Loading branch information
MichaelBurgess committed Dec 19, 2024
1 parent 6cba7bb commit 404b0e7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ui/dashboard/src/hooks/useDashboardExecution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const DashboardExecutionProvider = ({
const selectedDashboardRef = useRef<string | null>(
selectedDashboard?.full_name || null,
);
const { selectPanel } = useDashboardPanelDetail();
const { selectPanel, closeSidePanel } = useDashboardPanelDetail();
const { eventHandler } = useDashboardWebSocketEventHandler(
dispatch,
eventHooks,
Expand All @@ -70,6 +70,15 @@ export const DashboardExecutionProvider = ({
useDashboardInputs();
const { searchPathPrefix } = useDashboardSearchPath();

useEffect(() => {
if (
!!selectedDashboardRef.current &&
selectedDashboardRef.current !== dashboard_name
) {
closeSidePanel();
}
}, [dashboard_name]);

const clearDashboard = () => {
// Clear any existing executions
sendMessage({
Expand All @@ -79,6 +88,8 @@ export const DashboardExecutionProvider = ({
`../${!!searchPathPrefix.length ? `?search_path_prefix=${searchPathPrefix}` : ""}`,
{ replace: true },
);
setLastChangedInput(null);
closeSidePanel();
dispatch({
type: DashboardActions.CLEAR_DASHBOARD,
});
Expand All @@ -89,7 +100,7 @@ export const DashboardExecutionProvider = ({
return;
}
clearDashboard();
}, [pathname, searchPathPrefix]);
}, [dispatch, pathname, searchPathPrefix]);

const loadSnapshot = useCallback(
(
Expand Down

0 comments on commit 404b0e7

Please sign in to comment.