mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
37e4353a18
commit
d177e57f7e
@ -220,7 +220,7 @@ describe('DashboardScenePage', () => {
|
|||||||
|
|
||||||
describe('empty state', () => {
|
describe('empty state', () => {
|
||||||
it('Shows empty state when dashboard is empty', async () => {
|
it('Shows empty state when dashboard is empty', async () => {
|
||||||
loadDashboardMock.mockResolvedValue({ dashboard: { panels: [] }, meta: {} });
|
loadDashboardMock.mockResolvedValue({ dashboard: { uid: 'my-dash-uid', panels: [] }, meta: {} });
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
expect(await screen.findByText('Start your new dashboard by adding a visualization')).toBeInTheDocument();
|
expect(await screen.findByText('Start your new dashboard by adding a visualization')).toBeInTheDocument();
|
||||||
@ -299,7 +299,7 @@ describe('DashboardScenePage', () => {
|
|||||||
it('should show controls', async () => {
|
it('should show controls', async () => {
|
||||||
getDashboardScenePageStateManager().clearDashboardCache();
|
getDashboardScenePageStateManager().clearDashboardCache();
|
||||||
loadDashboardMock.mockClear();
|
loadDashboardMock.mockClear();
|
||||||
loadDashboardMock.mockResolvedValue({ dashboard: { panels: [] }, meta: {} });
|
loadDashboardMock.mockResolvedValue({ dashboard: { uid: 'my-dash-uid', panels: [] }, meta: {} });
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ export function DashboardScenePage({ match, route, queryParams, history }: Props
|
|||||||
// Do not render anything when transitioning from one dashboard to another
|
// Do not render anything when transitioning from one dashboard to another
|
||||||
if (
|
if (
|
||||||
match.params.type !== 'snapshot' &&
|
match.params.type !== 'snapshot' &&
|
||||||
dashboard.state.uid &&
|
match.params.uid &&
|
||||||
dashboard.state.uid !== match.params.uid &&
|
dashboard.state.uid !== match.params.uid &&
|
||||||
route.routeName !== DashboardRoutes.Home
|
route.routeName !== DashboardRoutes.Home
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user