fix: fix error for only Create role when publishing flow

This commit is contained in:
kasia.oczkowska
2024-07-04 14:08:35 +01:00
parent 1b4fb2ce6e
commit 0666174501

View File

@@ -36,23 +36,18 @@ export default function EditorLayout() {
const onFlowNameUpdate = React.useCallback( const onFlowNameUpdate = React.useCallback(
async (name) => { async (name) => {
await updateFlow({ try {
variables: { await updateFlow({
input: { variables: {
id: flowId, input: {
name, id: flowId,
name,
},
}, },
}, });
optimisticResponse: {
updateFlow: {
__typename: 'Flow',
id: flowId,
name,
},
},
});
await queryClient.invalidateQueries({ queryKey: ['flows', flowId] }); await queryClient.invalidateQueries({ queryKey: ['flows', flowId] });
} catch (e) {}
}, },
[flowId, queryClient], [flowId, queryClient],
); );
@@ -67,13 +62,6 @@ export default function EditorLayout() {
active, active,
}, },
}, },
optimisticResponse: {
updateFlowStatus: {
__typename: 'Flow',
id: flowId,
active,
},
},
}); });
await queryClient.invalidateQueries({ queryKey: ['flows', flowId] }); await queryClient.invalidateQueries({ queryKey: ['flows', flowId] });
@@ -126,7 +114,7 @@ export default function EditorLayout() {
<Button <Button
variant="contained" variant="contained"
size="small" size="small"
onClick={() => onFlowStatusUpdate(!flow.active)} onClick={() => onFlowStatusUpdate(flow ? !flow.active : false)}
data-test={ data-test={
flow?.active ? 'unpublish-flow-button' : 'publish-flow-button' flow?.active ? 'unpublish-flow-button' : 'publish-flow-button'
} }