|
|
|
|
@ -4,6 +4,8 @@ import { debounce } from 'lodash';
|
|
|
|
|
import { useSelector, useDispatch } from 'react-redux';
|
|
|
|
|
import { updateCanvasDataMap } from '@/store/ideContainer';
|
|
|
|
|
|
|
|
|
|
import { Dispatch } from 'redux';
|
|
|
|
|
|
|
|
|
|
export const useFlowEditorState = (initialData?: any) => {
|
|
|
|
|
const [nodes, setNodes] = useState<Node[]>([]);
|
|
|
|
|
const [edges, setEdges] = useState<Edge[]>([]);
|
|
|
|
|
@ -27,7 +29,7 @@ export const useFlowEditorState = (initialData?: any) => {
|
|
|
|
|
const historyTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
|
|
|
|
|
|
|
|
const updateCanvasDataMapDebounced = useRef(
|
|
|
|
|
debounce((dispatch: Function, canvasDataMap: any, id: string, nodes: Node[], edges: Edge[]) => {
|
|
|
|
|
debounce((dispatch: Dispatch<any>, canvasDataMap: any, id: string, nodes: Node[], edges: Edge[]) => {
|
|
|
|
|
dispatch(updateCanvasDataMap({
|
|
|
|
|
...canvasDataMap,
|
|
|
|
|
[id]: { nodes, edges }
|
|
|
|
|
|