From 46a63808d696a0cda4ad8160f5f90e9ffeabc750 Mon Sep 17 00:00:00 2001 From: smallstonesk <575913857@qq.com> Date: Tue, 19 Jan 2021 14:32:20 +0800 Subject: [PATCH] fix: continuous logs will be missed in Console component --- packages/core/src/components/console/index.tsx | 4 ++-- packages/core/src/mods/flowChart/codeEditorModel/index.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/console/index.tsx b/packages/core/src/components/console/index.tsx index bfee8e5..006192e 100644 --- a/packages/core/src/components/console/index.tsx +++ b/packages/core/src/components/console/index.tsx @@ -88,7 +88,7 @@ const MyConsole: React.FC = () => { return () => { resetConsole(); }; - }, [logList]); + }, []); useEffect(() => { const filteredLogs = cache.current.allLogs @@ -110,7 +110,7 @@ const MyConsole: React.FC = () => { // @ts-ignore window.console[method] = (...args: any[]) => { hijackMap[method].originMethod(...args); - cache.current.allLogs = logList.concat({ + cache.current.allLogs = cache.current.allLogs.concat({ type: method, data: args, strVal: Helper.getArgsToString(args) diff --git a/packages/core/src/mods/flowChart/codeEditorModel/index.tsx b/packages/core/src/mods/flowChart/codeEditorModel/index.tsx index 4113498..1c939fb 100644 --- a/packages/core/src/mods/flowChart/codeEditorModel/index.tsx +++ b/packages/core/src/mods/flowChart/codeEditorModel/index.tsx @@ -87,6 +87,7 @@ const CodeEditModal: React.FC = (props) => { setVisible(false); }; const onRunCode = (): void => { + updateNodeCode(code); flowChart.trigger('graph:runCode'); }; const onChangeCode = (ev: any, newCode: string | undefined = ''): void => {