From 06661745019e95423aaedeaa8a5f134880ce5cd6 Mon Sep 17 00:00:00 2001 From: "kasia.oczkowska" Date: Thu, 4 Jul 2024 14:08:35 +0100 Subject: [PATCH 1/2] fix: fix error for only Create role when publishing flow --- .../web/src/components/EditorLayout/index.jsx | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/packages/web/src/components/EditorLayout/index.jsx b/packages/web/src/components/EditorLayout/index.jsx index 37819435..690f4625 100644 --- a/packages/web/src/components/EditorLayout/index.jsx +++ b/packages/web/src/components/EditorLayout/index.jsx @@ -36,23 +36,18 @@ export default function EditorLayout() { const onFlowNameUpdate = React.useCallback( async (name) => { - await updateFlow({ - variables: { - input: { - id: flowId, - name, + try { + await updateFlow({ + variables: { + input: { + 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], ); @@ -67,13 +62,6 @@ export default function EditorLayout() { active, }, }, - optimisticResponse: { - updateFlowStatus: { - __typename: 'Flow', - id: flowId, - active, - }, - }, }); await queryClient.invalidateQueries({ queryKey: ['flows', flowId] }); @@ -126,7 +114,7 @@ export default function EditorLayout() { + + {(allowed) => ( + + )} +