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 ce33ef38d6dc3..07d749c5677dc 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) {