Browse Source

fix: check whether code has changed before updating node's data to avoid frequent message tips

master
smallstonesk 4 years ago
parent
commit
0659a0ae4c
  1. 7
      packages/core/src/mods/flowChart/codeEditorModel/index.tsx

7
packages/core/src/mods/flowChart/codeEditorModel/index.tsx

@ -25,8 +25,13 @@ const CodeEditModal: React.FC<IProps> = (props) => {
const [visible, setVisible] = useState<boolean>(false);
const updateNodeCode = (code: string): void => {
const cell = flowChart.getSelectedCells()[0];
const { dependencies } = cell.getData();
const { code: oldCode, dependencies } = cell.getData();
if(code === oldCode) {
return;
}
cell.setData({ code });
message.success('代码保存成功', 1);
const excludeDeps = safeParse(dependencies);

Loading…
Cancel
Save