diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/url_helper.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/url_helper.ts index 2e360567c4653..73383f2ff3f68 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/url_helper.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/url_helper.ts @@ -25,11 +25,9 @@ import { DashboardConstants } from './dashboard_constants'; */ export function getUrlVars(url: string): Record { const vars: Record = {}; - // @ts-ignore - url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(_, key, value) { - // @ts-ignore + for (const [, key, value] of url.matchAll(/[?&]+([^=&]+)=([^&]*)/gi)) { vars[key] = decodeURIComponent(value); - }); + } return vars; } diff --git a/x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx b/x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx index 7465de2dba7f1..f7d9ae5741afb 100644 --- a/x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx +++ b/x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx @@ -103,13 +103,13 @@ export class AppPlugin { }) ); const updateUrlTime = (urlVars: Record): void => { - const decoded: RisonObject = rison.decode(urlVars._g) as RisonObject; - if (!decoded) { + const decoded = rison.decode(urlVars._g); + if (!isRisonObject(decoded)) { return; } // @ts-ignore decoded.time = data.query.timefilter.timefilter.getTime(); - urlVars._g = rison.encode((decoded as unknown) as RisonObject); + urlVars._g = rison.encode(decoded); }; const redirectTo = ( routeProps: RouteComponentProps<{ id?: string }>,