piyushraj001 opened a new pull request, #45827:
URL: https://github.com/apache/superset/pull/45827
### SUMMARY
Fixes #45825.
A dashboard opened directly by URL keeps its name in the browser tab after
you
navigate away within the app (home page, dashboard list, etc.). #16254 fixed
this in 2021 and it regressed in 6.1.0.
#37370 changed the unmount cleanup in `DashboardPage` from
`document.title = 'Superset'` to saving `document.title` at mount and
restoring
it on unmount. On a direct page load the server has already rendered the
dashboard name into `<title>` (`render_app_template(...,
title=dashboard.dashboard_title)`),
so the saved "original" title *is* the dashboard name, and that is what gets
restored.
`ExploreViewContainer` uses the same pattern and the explore view also
renders
the chart name as `<title>`, so charts opened directly by URL are affected
the
same way.
Both components now restore `theme.brandAppName || theme.brandLogoAlt ||
'Superset'`
on unmount instead of the title captured at mount. When a dashboard or chart
is
entered from within the SPA the title at mount is already the brand name, so
that path behaves identically — only the broken direct-load case changes.
Added a regression test to each component: set `document.title` to the
server-rendered name before mounting, then ount. Both
fail without the fix.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
**Before:** the tab still reads the dashboard's name while on the home page
(see the screenshot in #45825).
**After:** the tab reads `Superset`, or the.
### TESTING INSTRUCTIONS
Manual:
1. Open a dashboard directly by URL in a frashboard/1/`.
The tab title is the dashboard's name, as expected.
2. Use the top menu to go to Dashboards or
3. The tab title should go back to `Superset` (or your `brandAppName`).
4. Same for charts: open `/explore/?slice_iigate away —
the title should go back to the app name.
Automated:
```bash
cd superset-frontend
npm run test -- src/dashboard/containers/DashboardPage.test.tsx
npm run test -- src/explore/components/ExplewContainer.test.tsx
```
Note: `ExploreViewContainer.test.tsx` has 6 pre-existing `Ctrl/Cmd+Enter`
failures on `master`, unrelated to this cha
### ADDITIONAL INFORMATION
- [x] Has associated issue: #45825
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and do
- [ ] 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]