From aacdc90fc2b59da814be63d45b637c7e8283357c Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 27 Aug 2021 04:55:32 -0400 Subject: [PATCH] Clears resolved arg on embeddable destroy (#109945) (#110393) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Catherine Liu --- x-pack/plugins/canvas/public/lib/create_handlers.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/plugins/canvas/public/lib/create_handlers.ts b/x-pack/plugins/canvas/public/lib/create_handlers.ts index aba29ccd542be..dfc4387bcbf92 100644 --- a/x-pack/plugins/canvas/public/lib/create_handlers.ts +++ b/x-pack/plugins/canvas/public/lib/create_handlers.ts @@ -14,6 +14,7 @@ import { import { setFilter } from '../state/actions/elements'; import { updateEmbeddableExpression, fetchEmbeddableRenderable } from '../state/actions/embeddable'; import { RendererHandlers, CanvasElement } from '../../types'; +import { clearValue } from '../state/actions/resolved_args'; // This class creates stub handlers to ensure every element and renderer fulfills the contract. // TODO: consider warning if these methods are invoked but not implemented by the renderer...? @@ -123,6 +124,8 @@ export const createDispatchedHandlerFactory = ( }, onEmbeddableDestroyed() { + const argumentPath = [element.id, 'expressionRenderable']; + dispatch(clearValue({ path: argumentPath })); dispatch(fetchEmbeddableRenderable(element.id)); },