sfirke opened a new issue, #45825:
URL: https://github.com/apache/superset/issues/45825

   ### Bug description
   
   When a dashboard is the first page loaded in a browser tab, the tab title 
keeps showing the dashboard's name after you navigate away within the app (e.g. 
to the home page or the dashboard list). #16254 fixed this in 2021, but it came 
back in 6.1.0.
   
   Steps to reproduce: this one is easy!
   
   1. Open a dashboard directly by URL (fresh page load), e.g. 
/superset/dashboard/<id>/.
   2. The tab title is the dashboard's name, as expected.
   3. Use the top menu to go to Dashboards or the home page.
   4. The tab title is still the dashboard's name.
   
   Expected: the title goes back to the app name (brandAppName, or "Superset" 
by default).
   
   If you start on the home page or the dashboard list and then click into a 
dashboard, the title is restored correctly when you leave. Once the title is 
stuck, though, opening another dashboard carries the stale name forward, so it 
stays wrong.
   
   **Root cause** - this part is 100% AI unverified by me, I am only vouching 
for the bug experience itself:
   
   #37370 changed the unmount cleanup in 
`superset-frontend/src/dashboard/containers/DashboardPage.tsx`. It used to set 
`document.title = 'Superset'`. It now saves whatever `document.title` is on 
mount (`originalTitle = useMemo(() => document.title, [])`) and restores that 
value on unmount.
   
   On a fresh load of a dashboard URL, the server has already rendered 
`<title>` as the dashboard name (`superset/views/core.py`, 
`render_app_template(..., title=dashboard.dashboard_title)`). So the saved 
"original" title is the dashboard name, and that's what gets restored.
   
   `ExploreViewContainer/index.tsx` uses the same pattern, and the explore view 
also renders the chart name as `<title>`. Charts opened directly by URL are 
probably affected the same way.
   
   Suggested fix: on unmount, restore `theme.brandAppName || theme.brandLogoAlt 
|| 'Superset'` instead of the saved title, in both components. Add a regression 
test that sets `document.title` to the dashboard name before mounting 
`DashboardPage`, then checks the title after unmount. I confirmed that this 
test fails on master branch.
   
   ### Screenshots/recordings
   
   Look at the dashboard tab text while I'm on the home page:
   
   <img width="924" height="500" alt="Image" 
src="https://github.com/user-attachments/assets/be92efc6-ca84-4989-a421-49c9c52dd8cd";
 />
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   Not applicable
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Firefox
   
   ### Additional context
   
   Present in 6.1.0 and master
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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]

Reply via email to