From e992ef1c915505306ccd6b62992b4bb8343cd4c0 Mon Sep 17 00:00:00 2001 From: Maja Grubic Date: Sun, 5 Jan 2020 09:16:07 +0000 Subject: [PATCH] [Lens] Expression type on document can be null (#53883) Co-authored-by: Elastic Machine --- x-pack/legacy/plugins/lens/public/app_plugin/app.tsx | 1 + .../editor_frame_plugin/embeddable/expression_wrapper.tsx | 4 ++-- .../plugins/lens/public/persistence/saved_object_store.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx b/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx index 443bcf99a4f09..cb57f2c884e38 100644 --- a/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/legacy/plugins/lens/public/app_plugin/app.tsx @@ -152,6 +152,7 @@ export function App({ const isSaveable = lastKnownDoc && + lastKnownDoc.expression && lastKnownDoc.expression.length > 0 && core.application.capabilities.visualize.save; diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/expression_wrapper.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/expression_wrapper.tsx index 3dd4373347129..9b85e89cd80eb 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/expression_wrapper.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_plugin/embeddable/expression_wrapper.tsx @@ -13,7 +13,7 @@ import { ExpressionRenderer } from 'src/plugins/expressions/public'; export interface ExpressionWrapperProps { ExpressionRenderer: ExpressionRenderer; - expression: string; + expression: string | null; context: { timeRange?: TimeRange; query?: Query; @@ -29,7 +29,7 @@ export function ExpressionWrapper({ }: ExpressionWrapperProps) { return ( - {expression === '' ? ( + {expression === null || expression === '' ? ( diff --git a/x-pack/legacy/plugins/lens/public/persistence/saved_object_store.ts b/x-pack/legacy/plugins/lens/public/persistence/saved_object_store.ts index 4337482663a9c..1d36e18c726ec 100644 --- a/x-pack/legacy/plugins/lens/public/persistence/saved_object_store.ts +++ b/x-pack/legacy/plugins/lens/public/persistence/saved_object_store.ts @@ -13,7 +13,7 @@ export interface Document { type?: string; visualizationType: string | null; title: string; - expression: string; + expression: string | null; state: { datasourceMetaData: { filterableIndexPatterns: Array<{ id: string; title: string }>;