chore: workflow sync with hash (#4250)

This commit is contained in:
zxhlyh
2024-05-10 14:48:20 +08:00
committed by GitHub
parent f49c99937c
commit a1ab87107b
8 changed files with 74 additions and 22 deletions

View File

@@ -385,6 +385,7 @@ export const useWorkflowInit = () => {
} = useWorkflowTemplate()
const { handleFetchAllTools } = useFetchToolsData()
const appDetail = useAppStore(state => state.appDetail)!
const setSyncWorkflowDraftHash = useStore(s => s.setSyncWorkflowDraftHash)
const [data, setData] = useState<FetchWorkflowDraftResponse>()
const [isLoading, setIsLoading] = useState(true)
workflowStore.setState({ appId: appDetail.id })
@@ -394,6 +395,7 @@ export const useWorkflowInit = () => {
const res = await fetchWorkflowDraft(`/apps/${appDetail.id}/workflows/draft`)
setData(res)
setSyncWorkflowDraftHash(res.hash)
setIsLoading(false)
}
catch (error: any) {
@@ -418,7 +420,7 @@ export const useWorkflowInit = () => {
})
}
}
}, [appDetail, nodesTemplate, edgesTemplate, workflowStore])
}, [appDetail, nodesTemplate, edgesTemplate, workflowStore, setSyncWorkflowDraftHash])
useEffect(() => {
handleGetInitialWorkflowData()