Fixed multiple set pending on move making it lag
This commit is contained in:
parent
081b6a63be
commit
c28817ed3b
1 changed files with 3 additions and 2 deletions
|
|
@ -72,7 +72,7 @@ export default function Page({
|
||||||
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const { takeSnapshot } = useContext(undoRedoContext);
|
const { takeSnapshot } = useContext(undoRedoContext);
|
||||||
const { nodes, edges, setNodes, setEdges, onNodesChange, onEdgesChange, setPending, saveFlow } = useContext(FlowsContext);
|
const { nodes, edges, setNodes, setEdges, onNodesChange, onEdgesChange, setPending, saveFlow, isPending } = useContext(FlowsContext);
|
||||||
|
|
||||||
const position = useRef({ x: 0, y: 0 });
|
const position = useRef({ x: 0, y: 0 });
|
||||||
const [lastSelection, setLastSelection] =
|
const [lastSelection, setLastSelection] =
|
||||||
|
|
@ -370,6 +370,7 @@ export default function Page({
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onMove = useCallback(() => {
|
const onMove = useCallback(() => {
|
||||||
|
if(!isPending)
|
||||||
setPending(true);
|
setPending(true);
|
||||||
}, [setPending]);
|
}, [setPending]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue