From b9c01368c39580ebf90d4395b0b6e3208e916aca Mon Sep 17 00:00:00 2001 From: geido Date: Wed, 18 Aug 2021 14:57:36 +0200 Subject: [PATCH 1/2] Return original title on unmount --- superset-frontend/src/dashboard/containers/DashboardPage.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/superset-frontend/src/dashboard/containers/DashboardPage.tsx b/superset-frontend/src/dashboard/containers/DashboardPage.tsx index d98e6ed7a1bc8..8b14b76f3d529 100644 --- a/superset-frontend/src/dashboard/containers/DashboardPage.tsx +++ b/superset-frontend/src/dashboard/containers/DashboardPage.tsx @@ -42,6 +42,8 @@ const DashboardContainer = React.lazy( ), ); +const documentTitle = document.title; + const DashboardPage: FC = () => { const dispatch = useDispatch(); const { addDangerToast } = useToasts(); @@ -71,6 +73,9 @@ const DashboardPage: FC = () => { if (dashboard_title) { document.title = dashboard_title; } + return () => { + document.title = documentTitle; + }; }, [dashboard_title]); useEffect(() => { From b6a07c310992891688fd9e5ecab57a49aa41bde1 Mon Sep 17 00:00:00 2001 From: geido Date: Thu, 19 Aug 2021 16:49:41 +0200 Subject: [PATCH 2/2] Name var originalDocumentTitle --- superset-frontend/src/dashboard/containers/DashboardPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/dashboard/containers/DashboardPage.tsx b/superset-frontend/src/dashboard/containers/DashboardPage.tsx index 8b14b76f3d529..878d2117ec7b7 100644 --- a/superset-frontend/src/dashboard/containers/DashboardPage.tsx +++ b/superset-frontend/src/dashboard/containers/DashboardPage.tsx @@ -42,7 +42,7 @@ const DashboardContainer = React.lazy( ), ); -const documentTitle = document.title; +const originalDocumentTitle = document.title; const DashboardPage: FC = () => { const dispatch = useDispatch(); @@ -74,7 +74,7 @@ const DashboardPage: FC = () => { document.title = dashboard_title; } return () => { - document.title = documentTitle; + document.title = originalDocumentTitle; }; }, [dashboard_title]);