tiptap: fix render flow

pull/44/head
fantasticit 2022-05-19 14:50:59 +08:00
parent 43f83ff243
commit 67410ce2a4
1 changed files with 4 additions and 2 deletions

View File

@ -96,14 +96,16 @@ export const FlowWrapper = ({ editor, node, updateAttributes }) => {
const setMxgraph = useCallback(
(div) => {
$container.current = div;
if (!isEditorReady) return;
render(div);
},
[render]
[isEditorReady, render]
);
useEffect(() => {
if (!isEditorReady) return;
render($container.current);
}, [graphData, render]);
}, [isEditorReady, graphData, render]);
return (
<NodeViewWrapper className={cls(styles.wrap, isActive && styles.isActive)}>