diff --git a/examples/vite-app/src/examples/Stress/index.tsx b/examples/vite-app/src/examples/Stress/index.tsx index ec1fd2fa..7e83fac7 100644 --- a/examples/vite-app/src/examples/Stress/index.tsx +++ b/examples/vite-app/src/examples/Stress/index.tsx @@ -1,4 +1,4 @@ -import { useState, CSSProperties, useCallback } from 'react'; +import { useState, useCallback } from 'react'; import { ReactFlow, ReactFlowInstance, @@ -13,17 +13,11 @@ import { Controls, Background, MiniMap, + Panel, } from '@xyflow/react'; import { getNodesAndEdges } from './utils'; -const buttonWrapperStyles: CSSProperties = { - position: 'absolute', - right: 10, - top: 10, - zIndex: 4, -}; - const onInit = (reactFlowInstance: ReactFlowInstance) => { reactFlowInstance.fitView(); console.log(reactFlowInstance.getNodes()); @@ -80,12 +74,10 @@ const StressFlow = () => { -
- + + -
+ ); }; diff --git a/packages/react/src/container/Pane/index.tsx b/packages/react/src/container/Pane/index.tsx index e1d26022..84e38b55 100644 --- a/packages/react/src/container/Pane/index.tsx +++ b/packages/react/src/container/Pane/index.tsx @@ -11,7 +11,7 @@ import UserSelection from '../../components/UserSelection'; import { containerStyle } from '../../styles'; import { useStore, useStoreApi } from '../../hooks/useStore'; import { getSelectionChanges, getConnectedEdges } from '../../utils'; -import type { ReactFlowProps, ReactFlowState, NodeChange, EdgeChange, Node } from '../../types'; +import type { ReactFlowProps, ReactFlowState, NodeChange, EdgeChange } from '../../types'; type PaneProps = { isSelecting: boolean; @@ -148,7 +148,7 @@ const Pane = memo( height: Math.abs(mousePos.y - startY), }; - const selectedNodes = getNodesInside( + const selectedNodes = getNodesInside( nodes, nextUserSelectRect, transform, diff --git a/packages/react/src/store/index.ts b/packages/react/src/store/index.ts index e227d113..52100f9e 100644 --- a/packages/react/src/store/index.ts +++ b/packages/react/src/store/index.ts @@ -112,7 +112,6 @@ const createRFStore = () => const nextFitViewOnInitDone = fitViewOnInitDone || (fitViewOnInit && - !fitViewOnInitDone && !!panZoom && fitView( { @@ -133,8 +132,6 @@ const createRFStore = () => } }, updateNodePositions: (nodeDragItems, positionChanged = true, dragging = false) => { - const { triggerNodeChanges } = get(); - const changes = nodeDragItems.map((node) => { const change: NodePositionChange = { id: node.id, @@ -150,7 +147,7 @@ const createRFStore = () => return change; }); - triggerNodeChanges(changes); + get().triggerNodeChanges(changes); }, triggerNodeChanges: (changes) => {