Skip to content

Commit

Permalink
ShareModal: delete shareView query param from url (grafana#92243)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucychen-grafana authored Aug 21, 2024
1 parent 733ae1f commit 2ad9d8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion public/app/features/dashboard-scene/utils/urlBuilders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ describe('dashboard utils', () => {
expect(url).toBe('/d/dash-1/dash-1-slug/panel-edit/2?orgId=1&filter=A');
});

it('Can getUrl with params removed and addded', () => {
it('Can getURL without shareView param', async () => {
const url = getDashboardUrl({
uid: 'dash-1',
currentQueryParams: '?orgId=1&filter=A&shareView=link',
});

expect(url).toBe('/d/dash-1?orgId=1&filter=A');
});

it('Can getUrl with params removed and added', () => {
const url = getDashboardUrl({
uid: 'dash-1',
currentQueryParams: '?orgId=1&filter=A',
Expand Down
2 changes: 2 additions & 0 deletions public/app/features/dashboard-scene/utils/urlBuilders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export function getDashboardUrl(options: DashboardUrlOptions) {

const params = options.currentQueryParams ? locationSearchToObject(options.currentQueryParams) : {};

delete params['shareView'];

if (options.updateQuery) {
for (const key in options.updateQuery) {
// removing params with null | undefined
Expand Down

0 comments on commit 2ad9d8c

Please sign in to comment.