jesperct commented on code in PR #40730:
URL: https://github.com/apache/superset/pull/40730#discussion_r3363336581
##########
superset-frontend/src/dashboard/containers/DashboardPage.tsx:
##########
@@ -152,6 +153,14 @@ export const DashboardPage: FC<PageProps> = ({ idOrSlug }:
PageProps) => {
const readyToRender = Boolean(dashboard && charts);
const { dashboard_title, id = 0 } = dashboard || {};
+ // The live title is edited in Redux and persisted via an in-SPA save with no
+ // full reload, so the useDashboard() API result can be stale. Track the live
+ // title so the browser tab stays in sync after a rename.
+ const liveDashboardTitle = useSelector<RootState, string | undefined>(
+ state => state.dashboardLayout?.present?.[DASHBOARD_HEADER_ID]?.meta?.text,
+ );
+ const pageTitle = liveDashboardTitle || dashboard_title;
Review Comment:
Confirmed. DashboardPage has no key on the route, so it gets reused across
SPA navigation and the lingering dashboardLayout kept the previous dashboard's
title until the new one hydrated. The live title is now used only when the
hydrated dashboard id matches the dashboard being shown, otherwise it falls
back to the API title. Added a test for the navigation case. Fixed in c2843f1.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]