diff --git a/packages/web/src/components/FlowContextMenu/index.jsx b/packages/web/src/components/FlowContextMenu/index.jsx index 1b941b3b..bba8f10b 100644 --- a/packages/web/src/components/FlowContextMenu/index.jsx +++ b/packages/web/src/components/FlowContextMenu/index.jsx @@ -28,9 +28,12 @@ function ContextMenu(props) { variables: { input: { id: flowId } }, }); - await queryClient.invalidateQueries({ - queryKey: ['apps', appKey, 'flows'], - }); + if (appKey) { + await queryClient.invalidateQueries({ + queryKey: ['apps', appKey, 'flows'], + }); + } + enqueueSnackbar(formatMessage('flow.successfullyDuplicated'), { variant: 'success', SnackbarProps: { @@ -56,9 +59,12 @@ function ContextMenu(props) { }, }); - await queryClient.invalidateQueries({ - queryKey: ['apps', appKey, 'flows'], - }); + if (appKey) { + await queryClient.invalidateQueries({ + queryKey: ['apps', appKey, 'flows'], + }); + } + enqueueSnackbar(formatMessage('flow.successfullyDeleted'), { variant: 'success', }); @@ -110,7 +116,7 @@ ContextMenu.propTypes = { ]).isRequired, onDeleteFlow: PropTypes.func, onDuplicateFlow: PropTypes.func, - appKey: PropTypes.string.isRequired, + appKey: PropTypes.string, }; export default ContextMenu; diff --git a/packages/web/src/components/FlowRow/index.jsx b/packages/web/src/components/FlowRow/index.jsx index e93b3a9b..3daae684 100644 --- a/packages/web/src/components/FlowRow/index.jsx +++ b/packages/web/src/components/FlowRow/index.jsx @@ -38,20 +38,24 @@ function FlowRow(props) { const contextButtonRef = React.useRef(null); const [anchorEl, setAnchorEl] = React.useState(null); const { flow, onDuplicateFlow, onDeleteFlow, appKey } = props; + const handleClose = () => { setAnchorEl(null); }; + const onContextMenuClick = (event) => { event.preventDefault(); event.stopPropagation(); event.nativeEvent.stopImmediatePropagation(); setAnchorEl(contextButtonRef.current); }; + const createdAt = DateTime.fromMillis(parseInt(flow.createdAt, 10)); const updatedAt = DateTime.fromMillis(parseInt(flow.updatedAt, 10)); const isUpdated = updatedAt > createdAt; const relativeCreatedAt = createdAt.toRelative(); const relativeUpdatedAt = updatedAt.toRelative(); + return ( <> @@ -127,7 +131,7 @@ FlowRow.propTypes = { flow: FlowPropType.isRequired, onDeleteFlow: PropTypes.func, onDuplicateFlow: PropTypes.func, - appKey: PropTypes.string.isRequired, + appKey: PropTypes.string, }; export default FlowRow;