DashboardScene: Fix url state sync issue when coming form Home dashboard to a cached dashboard scene (#93442)

* DashboardScene: Fixes preserve dashboard state for hidden options

* DashboardScene: Alt fix for pervering only specific url keys

* DashboardScene: Fixes url sync issue when coming from Home route

* Update

* Fix test
This commit is contained in:
Torkel Ödegaard 2024-09-18 17:57:15 +02:00 committed by GitHub
parent 37e4353a18
commit d177e57f7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -220,7 +220,7 @@ describe('DashboardScenePage', () => {
describe('empty state', () => {
it('Shows empty state when dashboard is empty', async () => {
loadDashboardMock.mockResolvedValue({ dashboard: { panels: [] }, meta: {} });
loadDashboardMock.mockResolvedValue({ dashboard: { uid: 'my-dash-uid', panels: [] }, meta: {} });
setup();
expect(await screen.findByText('Start your new dashboard by adding a visualization')).toBeInTheDocument();
@ -299,7 +299,7 @@ describe('DashboardScenePage', () => {
it('should show controls', async () => {
getDashboardScenePageStateManager().clearDashboardCache();
loadDashboardMock.mockClear();
loadDashboardMock.mockResolvedValue({ dashboard: { panels: [] }, meta: {} });
loadDashboardMock.mockResolvedValue({ dashboard: { uid: 'my-dash-uid', panels: [] }, meta: {} });
setup();

View File

@ -78,7 +78,7 @@ export function DashboardScenePage({ match, route, queryParams, history }: Props
// Do not render anything when transitioning from one dashboard to another
if (
match.params.type !== 'snapshot' &&
dashboard.state.uid &&
match.params.uid &&
dashboard.state.uid !== match.params.uid &&
route.routeName !== DashboardRoutes.Home
) {