From 8022ceaf156e073636a020c3f290930559a1b70c Mon Sep 17 00:00:00 2001 From: Maja Grubic Date: Mon, 6 Jan 2020 09:44:26 +0000 Subject: [PATCH] Fixing type error --- x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx | 4 ++-- x-pack/legacy/plugins/lens/public/app_plugin/url_helper.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 e2da57555e350..dc08019f0c457 100644 --- a/x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx +++ b/x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx @@ -118,9 +118,9 @@ export class AppPlugin { const lensUrl = `${getKibanaBasePathFromDashboardUrl( lastDashboardAbsoluteUrl )}/lens/edit/${id}`; - if (lensUrl) { + const dashboardUrlWithoutTime = getDashboardUrlWithoutTime(lastDashboardAbsoluteUrl); + if (lensUrl && dashboardUrlWithoutTime) { window.history.pushState({}, '', lensUrl); - const dashboardUrlWithoutTime = getDashboardUrlWithoutTime(lastDashboardAbsoluteUrl); const dashboardParsedUrl = addEmbeddableToDashboardUrl( dashboardUrlWithoutTime, id, diff --git a/x-pack/legacy/plugins/lens/public/app_plugin/url_helper.ts b/x-pack/legacy/plugins/lens/public/app_plugin/url_helper.ts index 1e066a4841cc6..d88c743811b77 100644 --- a/x-pack/legacy/plugins/lens/public/app_plugin/url_helper.ts +++ b/x-pack/legacy/plugins/lens/public/app_plugin/url_helper.ts @@ -66,7 +66,7 @@ export function addEmbeddableToDashboardUrl( * output: http://localhost:5601/lib/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0)) * @param url dashboard absolute url */ -export function getDashboardUrlWithoutTime(url: string | undefined): string { +export function getDashboardUrlWithoutTime(url: string | undefined): string | null { if (!url) { return null; }