From bb6bd85c1d66a3a4c2fb8827ad95477e7c5de9f5 Mon Sep 17 00:00:00 2001 From: Phuc Hung Nguyen <42292807+anthonyhungnguyen@users.noreply.github.com> Date: Mon, 9 Jun 2025 19:07:44 -0400 Subject: [PATCH] fix(chart): set tab name as chart name (#33694) Co-authored-by: Phuc Hung Nguyen --- .../src/dashboard/containers/DashboardPage.tsx | 4 +--- .../explore/components/ExploreViewContainer/index.jsx | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/dashboard/containers/DashboardPage.tsx b/superset-frontend/src/dashboard/containers/DashboardPage.tsx index fb8bb6c05d8..e56c400c320 100644 --- a/superset-frontend/src/dashboard/containers/DashboardPage.tsx +++ b/superset-frontend/src/dashboard/containers/DashboardPage.tsx @@ -71,8 +71,6 @@ const DashboardBuilder = lazy( ), ); -const originalDocumentTitle = document.title; - type PageProps = { idOrSlug: string; }; @@ -204,7 +202,7 @@ export const DashboardPage: FC = ({ idOrSlug }: PageProps) => { document.title = dashboard_title; } return () => { - document.title = originalDocumentTitle; + document.title = 'Superset'; }; }, [dashboard_title]); diff --git a/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx b/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx index 822a54ecafe..af71b790ec1 100644 --- a/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx +++ b/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx @@ -269,6 +269,15 @@ function ExploreViewContainer(props) { const theme = useTheme(); + useEffect(() => { + if (props.sliceName) { + document.title = props.sliceName; + } + return () => { + document.title = 'Superset'; + }; + }, [props.sliceName]); + const addHistory = useCallback( async ({ isReplace = false, title } = {}) => { const formData = props.dashboardId