diff --git a/public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx b/public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx index 4306467358b..9f3a559ff04 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx @@ -162,6 +162,17 @@ describe('ShareModal', () => { `http://localhost:3000/goto/${mockUid}` ); }); + + it('should generate render url without shareView param', async () => { + mockLocationHref('http://dashboards.grafana.com/d/abcdefghi/my-dash?shareView=link'); + render(); + + const base = 'http://dashboards.grafana.com/render/d-solo/abcdefghi/my-dash'; + const params = '?from=1000&to=2000&orgId=1&panelId=22&width=1000&height=500&tz=UTC'; + expect( + await screen.findByRole('link', { name: selectors.pages.SharePanelModal.linkToRenderedImage }) + ).toHaveAttribute('href', base + params); + }); }); }); diff --git a/public/app/features/dashboard/components/ShareModal/utils.ts b/public/app/features/dashboard/components/ShareModal/utils.ts index 1d760b40052..196af5376d4 100644 --- a/public/app/features/dashboard/components/ShareModal/utils.ts +++ b/public/app/features/dashboard/components/ShareModal/utils.ts @@ -52,6 +52,10 @@ export function buildParams({ // Token is unique to the authenticated identity and should not be shared with the URL, // so we are stripping it from the query params as a safety measure. searchParams.delete('auth_token'); + + // The shareView param is used to indicate that the sharing modal is open and should never be included in the URL + searchParams.delete('shareView'); + return searchParams; }