feat: update react flow library and improve state management

This commit is contained in:
kasia.oczkowska
2025-03-21 15:07:28 +00:00
parent 245d127170
commit 50c3067db3
16 changed files with 323 additions and 558 deletions

View File

@@ -1,15 +1,22 @@
import { Handle, Position } from 'reactflow';
import { useContext } from 'react';
import { Handle, Position } from '@xyflow/react';
import PropTypes from 'prop-types';
import FlowStep from 'components/FlowStep';
import { NodeWrapper, NodeInnerWrapper } from './style.js';
import { useContext } from 'react';
import { NodesContext } from '../EditorNew.jsx';
import { NodeWrapper, NodeInnerWrapper } from './style.js';
function FlowStepNode({ data: { collapsed, laidOut }, id }) {
const { openNextStep, onStepOpen, onStepClose, onStepChange, flowId, steps } =
useContext(NodesContext);
const {
openNextStep,
onStepOpen,
onStepClose,
onStepChange,
onStepDelete,
flowId,
steps,
} = useContext(NodesContext);
const step = steps.find(({ id: stepId }) => stepId === id);
@@ -36,6 +43,7 @@ function FlowStepNode({ data: { collapsed, laidOut }, id }) {
onChange={onStepChange}
flowId={flowId}
onContinue={() => openNextStep(step.id)}
onDelete={onStepDelete}
/>
)}
<Handle