feat: use try-catch block for updating flow status

This commit is contained in:
kasia.oczkowska
2024-07-03 13:54:52 +01:00
parent f842dd77df
commit ebea8d12d1

View File

@@ -59,23 +59,25 @@ export default function EditorLayout() {
const onFlowStatusUpdate = React.useCallback( const onFlowStatusUpdate = React.useCallback(
async (active) => { async (active) => {
await updateFlowStatus({ try {
variables: { await updateFlowStatus({
input: { variables: {
id: flowId, input: {
active, id: flowId,
active,
},
}, },
}, optimisticResponse: {
optimisticResponse: { updateFlowStatus: {
updateFlowStatus: { __typename: 'Flow',
__typename: 'Flow', id: flowId,
id: flowId, active,
active, },
}, },
}, });
});
await queryClient.invalidateQueries({ queryKey: ['flows', flowId] }); await queryClient.invalidateQueries({ queryKey: ['flows', flowId] });
} catch (err) {}
}, },
[flowId, queryClient], [flowId, queryClient],
); );