chore: release version v1.12.6

This commit is contained in:
Dmitry Popov
2024-10-25 14:16:28 +02:00
parent 0c751b3ced
commit 17653a6374
2 changed files with 11 additions and 10 deletions

View File

@@ -1,17 +1,18 @@
import { Node, useReactFlow } from 'reactflow'; import { Node, useReactFlow } from 'reactflow';
import { useCallback } from 'react'; import { useCallback, useRef } from 'react';
import { CommandAddSystems } from '@/hooks/Mapper/types/mapHandlers.ts'; import { CommandAddSystems } from '@/hooks/Mapper/types/mapHandlers.ts';
import { convertSystem2Node } from '../../helpers'; import { convertSystem2Node } from '../../helpers';
export const useMapAddSystems = () => { export const useMapAddSystems = () => {
const rf = useReactFlow(); const rf = useReactFlow();
return useCallback( const ref = useRef({ rf });
(systems: CommandAddSystems) => { ref.current = { rf };
return useCallback((systems: CommandAddSystems) => {
const { rf } = ref.current;
const nodes = rf.getNodes(); const nodes = rf.getNodes();
const prepared: Node[] = systems.filter(x => !nodes.some(y => x.id === y.id)).map(convertSystem2Node); const prepared: Node[] = systems.filter(x => !nodes.some(y => x.id === y.id)).map(convertSystem2Node);
rf.addNodes(prepared); rf.addNodes(prepared);
}, }, []);
[rf],
);
}; };