Skip to content

Commit

Permalink
fix: Return original document title when leaving a dashboard (apache#…
Browse files Browse the repository at this point in the history
…16323)

* Return original title on unmount

* Name var originalDocumentTitle
  • Loading branch information
geido authored Aug 24, 2021
1 parent 6bca6fe commit 85ea01e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions superset-frontend/src/dashboard/containers/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const DashboardContainer = React.lazy(
),
);

const originalDocumentTitle = document.title;

const DashboardPage: FC = () => {
const dispatch = useDispatch();
const { addDangerToast } = useToasts();
Expand Down Expand Up @@ -71,6 +73,9 @@ const DashboardPage: FC = () => {
if (dashboard_title) {
document.title = dashboard_title;
}
return () => {
document.title = originalDocumentTitle;
};
}, [dashboard_title]);

useEffect(() => {
Expand Down

0 comments on commit 85ea01e

Please sign in to comment.