Skip to content

Commit 2ad9d8c

Browse files
ShareModal: delete shareView query param from url (grafana#92243)
1 parent 733ae1f commit 2ad9d8c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

public/app/features/dashboard-scene/utils/urlBuilders.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ describe('dashboard utils', () => {
2828
expect(url).toBe('/d/dash-1/dash-1-slug/panel-edit/2?orgId=1&filter=A');
2929
});
3030

31-
it('Can getUrl with params removed and addded', () => {
31+
it('Can getURL without shareView param', async () => {
32+
const url = getDashboardUrl({
33+
uid: 'dash-1',
34+
currentQueryParams: '?orgId=1&filter=A&shareView=link',
35+
});
36+
37+
expect(url).toBe('/d/dash-1?orgId=1&filter=A');
38+
});
39+
40+
it('Can getUrl with params removed and added', () => {
3241
const url = getDashboardUrl({
3342
uid: 'dash-1',
3443
currentQueryParams: '?orgId=1&filter=A',

public/app/features/dashboard-scene/utils/urlBuilders.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export function getDashboardUrl(options: DashboardUrlOptions) {
6262

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

65+
delete params['shareView'];
66+
6567
if (options.updateQuery) {
6668
for (const key in options.updateQuery) {
6769
// removing params with null | undefined

0 commit comments

Comments
 (0)