refactor(types): cleanup
This commit is contained in:
@@ -3,9 +3,9 @@ import { useEffect, useRef } from 'react';
|
||||
import { pointToRendererPoint } from '../utils/graph';
|
||||
import { useStoreApi } from '../store';
|
||||
import useZoomPanHelper from '../hooks/useZoomPanHelper';
|
||||
import { OnLoadFunc, XYPosition, Node, Edge, FlowExportObject } from '../types';
|
||||
import { OnLoad, XYPosition, Node, Edge, FlowExportObject } from '../types';
|
||||
|
||||
function useOnLoadHandler(onLoad: OnLoadFunc<any> | undefined) {
|
||||
function useOnLoadHandler(onLoad: OnLoad<any> | undefined) {
|
||||
const isInitialized = useRef<boolean>(false);
|
||||
const store = useStoreApi();
|
||||
const { zoomIn, zoomOut, zoomTo, transform: setTransform, fitView, initialized } = useZoomPanHelper();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { useStore } from '../store';
|
||||
import { ElementId, UpdateNodeInternals, ReactFlowState } from '../types';
|
||||
import { UpdateNodeInternals, ReactFlowState } from '../types';
|
||||
|
||||
const updateNodeDimsSelector = (state: ReactFlowState) => state.updateNodeDimensions;
|
||||
|
||||
function useUpdateNodeInternals(): UpdateNodeInternals {
|
||||
const updateNodeDimensions = useStore(updateNodeDimsSelector);
|
||||
|
||||
return useCallback<UpdateNodeInternals>((id: ElementId) => {
|
||||
return useCallback<UpdateNodeInternals>((id: string) => {
|
||||
const nodeElement = document.querySelector(`.react-flow__node[data-id="${id}"]`) as HTMLDivElement;
|
||||
|
||||
if (nodeElement) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import shallow from 'zustand/shallow';
|
||||
|
||||
import { useStoreApi, useStore } from '../store';
|
||||
import { getRectOfNodes, pointToRendererPoint, getTransformForBounds } from '../utils/graph';
|
||||
import { FitViewParams, FlowTransform, ZoomPanHelperFunctions, Rect, XYPosition, ReactFlowState } from '../types';
|
||||
import { FitViewParams, FlowTransform, ZoomPanHelperFunctions, ReactFlowState, Rect, XYPosition } from '../types';
|
||||
|
||||
const DEFAULT_PADDING = 0.1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user