jesperct opened a new pull request, #40730:
URL: https://github.com/apache/superset/pull/40730
### SUMMARY
The browser tab title does not update when a dashboard is renamed. It is most
visible right after creating a new dashboard: you change the title, click
Save,
and the tab keeps showing `[ untitled dashboard ]` until you reload the page.
Root cause: `DashboardPage` binds `document.title` to the `dashboard_title`
returned by the `useDashboard()` API hook, which only refreshes on a full
page
load. Renaming a dashboard updates the live title in Redux
(`dashboardLayout` HEADER `meta.text`) and persists it through an in app save
that uses `history.pushState` with no reload, so the API value, and therefore
`document.title`, never refresh.
The fix sources `document.title` from the live Redux header title, falling
back
to the API `dashboard_title` before the layout is hydrated. This covers both
the
inline title editor and the Properties modal, and both new and existing
dashboards.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Verified locally on a new dashboard (`/dashboard/new/` redirects to a real
id):
- Before: rename to "My Renamed Dashboard" and Save. The header shows the new
name but `document.title` stays `[ untitled dashboard ]`. A manual reload
then
shows the correct title, confirming the data was saved and only the in app
binding was stale.
- After: `document.title` updates to "My Renamed Dashboard" as soon as the
title
changes, with no reload needed.
### TESTING INSTRUCTIONS
1. Create a new dashboard (the tab shows `[ untitled dashboard ]`).
2. Change the dashboard title and click Save.
3. The browser tab title should now reflect the new title without reloading.
4. Repeat on an existing dashboard: renaming and saving should update the tab
title immediately.
Unit tests: `npm run test -- src/dashboard/containers/DashboardPage.test.tsx`
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]