refactor(Flows): utilize useQuery over useMutation
This commit is contained in:
@@ -16,8 +16,7 @@ import useExportFlow from 'hooks/useExportFlow';
|
||||
import useDownloadJsonAsFile from 'hooks/useDownloadJsonAsFile';
|
||||
|
||||
function ContextMenu(props) {
|
||||
const { flowId, onClose, anchorEl, onDuplicateFlow, onDeleteFlow, appKey } =
|
||||
props;
|
||||
const { flowId, onClose, anchorEl, onDuplicateFlow, appKey } = props;
|
||||
const enqueueSnackbar = useEnqueueSnackbar();
|
||||
const formatMessage = useFormatMessage();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -67,14 +66,12 @@ function ContextMenu(props) {
|
||||
variant: 'success',
|
||||
});
|
||||
|
||||
onDeleteFlow?.();
|
||||
onClose();
|
||||
}, [
|
||||
deleteFlow,
|
||||
appKey,
|
||||
enqueueSnackbar,
|
||||
formatMessage,
|
||||
onDeleteFlow,
|
||||
onClose,
|
||||
queryClient,
|
||||
]);
|
||||
@@ -143,7 +140,6 @@ ContextMenu.propTypes = {
|
||||
PropTypes.func,
|
||||
PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
|
||||
]).isRequired,
|
||||
onDeleteFlow: PropTypes.func,
|
||||
onDuplicateFlow: PropTypes.func,
|
||||
appKey: PropTypes.string,
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ function FlowRow(props) {
|
||||
const formatMessage = useFormatMessage();
|
||||
const contextButtonRef = React.useRef(null);
|
||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||
const { flow, onDuplicateFlow, onDeleteFlow, appKey } = props;
|
||||
const { flow, onDuplicateFlow, appKey } = props;
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
@@ -118,7 +118,6 @@ function FlowRow(props) {
|
||||
flowId={flow.id}
|
||||
onClose={handleClose}
|
||||
anchorEl={anchorEl}
|
||||
onDeleteFlow={onDeleteFlow}
|
||||
onDuplicateFlow={onDuplicateFlow}
|
||||
appKey={appKey}
|
||||
/>
|
||||
@@ -129,7 +128,6 @@ function FlowRow(props) {
|
||||
|
||||
FlowRow.propTypes = {
|
||||
flow: FlowPropType.isRequired,
|
||||
onDeleteFlow: PropTypes.func,
|
||||
onDuplicateFlow: PropTypes.func,
|
||||
appKey: PropTypes.string,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user