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

@@ -18,7 +18,7 @@ export const useTagMenu = (
ref.current = { onSystemTag, systems, systemId }; ref.current = { onSystemTag, systems, systemId };
return useCallback(() => { return useCallback(() => {
const { onSystemTag, systemId , systems} = ref.current; const { onSystemTag, systemId, systems } = ref.current;
const system = systemId ? getSystemById(systems, systemId) : undefined; const system = systemId ? getSystemById(systems, systemId) : undefined;
const isSelectedLetters = AVAILABLE_LETTERS.includes(system?.tag ?? ''); const isSelectedLetters = AVAILABLE_LETTERS.includes(system?.tag ?? '');

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 };
const nodes = rf.getNodes();
const prepared: Node[] = systems.filter(x => !nodes.some(y => x.id === y.id)).map(convertSystem2Node); return useCallback((systems: CommandAddSystems) => {
rf.addNodes(prepared); const { rf } = ref.current;
}, const nodes = rf.getNodes();
[rf], const prepared: Node[] = systems.filter(x => !nodes.some(y => x.id === y.id)).map(convertSystem2Node);
); rf.addNodes(prepared);
}, []);
}; };