ShareModal: delete shareView query param from url (#92243)

pull/92238/head^2
Lucy Chen 11 months ago committed by GitHub
parent 733ae1f099
commit 2ad9d8cafe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      public/app/features/dashboard-scene/utils/urlBuilders.test.ts
  2. 2
      public/app/features/dashboard-scene/utils/urlBuilders.ts

@ -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',

@ -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

Loading…
Cancel
Save