feat: use try-catch block for updating flow status
This commit is contained in:
@@ -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],
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user