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

@@ -9,7 +9,7 @@ import useFormatMessage from 'hooks/useFormatMessage';
import { useQueryClient } from '@tanstack/react-query';
function FlowStepContextMenu(props) {
const { stepId, onClose, anchorEl, deletable, flowId } = props;
const { stepId, onClose, onDelete, anchorEl, deletable, flowId } = props;
const formatMessage = useFormatMessage();
const queryClient = useQueryClient();
const { mutateAsync: deleteStep } = useDeleteStep();
@@ -21,8 +21,9 @@ function FlowStepContextMenu(props) {
await deleteStep(stepId);
await queryClient.invalidateQueries({ queryKey: ['flows', flowId] });
onDelete?.(stepId);
},
[deleteStep, stepId, queryClient, flowId],
[deleteStep, onDelete, stepId, queryClient, flowId],
);
return (
@@ -44,6 +45,7 @@ function FlowStepContextMenu(props) {
FlowStepContextMenu.propTypes = {
stepId: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
onDelete: PropTypes.func,
anchorEl: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),