From 99922711531e18b47f88aac731df69cd43063d1c Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Tue, 27 Oct 2020 17:28:03 -0500 Subject: [PATCH] Update handlers before render --- .../public/components/render_with_fn/render_with_fn.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/canvas/public/components/render_with_fn/render_with_fn.tsx b/x-pack/plugins/canvas/public/components/render_with_fn/render_with_fn.tsx index ce33ef38d6dc..07d749c5677d 100644 --- a/x-pack/plugins/canvas/public/components/render_with_fn/render_with_fn.tsx +++ b/x-pack/plugins/canvas/public/components/render_with_fn/render_with_fn.tsx @@ -83,15 +83,13 @@ export const RenderWithFn: FC = ({ [] ); - useEffect(() => { + const render = useCallback(() => { if (!isEqual(handlers.current, incomingHandlers)) { handlers.current = incomingHandlers; } - }, [incomingHandlers]); - const render = useCallback(() => { renderFn(renderTarget.current!, config, handlers.current); - }, [renderTarget, config, renderFn]); + }, [renderTarget, config, renderFn, incomingHandlers]); useEffect(() => { if (!domNode) {