Skip to content

Commit

Permalink
Merge pull request #1895 from automatisch/fix-appkey-error-in-flowrow
Browse files Browse the repository at this point in the history
fix: remove unnecessary appKey in FlowRow and FlowContextMenu
  • Loading branch information
barinali committed May 31, 2024
2 parents 782f9b5 + c5202d7 commit b3c3998
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
20 changes: 13 additions & 7 deletions packages/web/src/components/FlowContextMenu/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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',
});
Expand Down Expand Up @@ -110,7 +116,7 @@ ContextMenu.propTypes = {
]).isRequired,
onDeleteFlow: PropTypes.func,
onDuplicateFlow: PropTypes.func,
appKey: PropTypes.string.isRequired,
appKey: PropTypes.string,
};

export default ContextMenu;
6 changes: 5 additions & 1 deletion packages/web/src/components/FlowRow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<Card sx={{ mb: 1 }} data-test="flow-row">
Expand Down Expand Up @@ -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;

0 comments on commit b3c3998

Please sign in to comment.