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( const setMxgraph = useCallback(
(div) => { (div) => {
$container.current = div; $container.current = div;
if (!isEditorReady) return;
render(div); render(div);
}, },
[render] [isEditorReady, render]
); );
useEffect(() => { useEffect(() => {
if (!isEditorReady) return;
render($container.current); render($container.current);
}, [graphData, render]); }, [isEditorReady, graphData, render]);
return ( return (
<NodeViewWrapper className={cls(styles.wrap, isActive && styles.isActive)}> <NodeViewWrapper className={cls(styles.wrap, isActive && styles.isActive)}>