mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 10:53:02 +00:00 
			
		
		
		
	
		
			
	
	
		
			28 lines
		
	
	
		
			645 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			645 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|   | import { useCallback } from 'react' | ||
|  | import produce from 'immer' | ||
|  | import { useStoreApi } from 'reactflow' | ||
|  | 
 | ||
|  | export const useEdgesInteractionsWithoutSync = () => { | ||
|  |   const store = useStoreApi() | ||
|  | 
 | ||
|  |   const handleEdgeCancelRunningStatus = useCallback(() => { | ||
|  |     const { | ||
|  |       edges, | ||
|  |       setEdges, | ||
|  |     } = store.getState() | ||
|  | 
 | ||
|  |     const newEdges = produce(edges, (draft) => { | ||
|  |       draft.forEach((edge) => { | ||
|  |         edge.data._sourceRunningStatus = undefined | ||
|  |         edge.data._targetRunningStatus = undefined | ||
|  |         edge.data._waitingRun = false | ||
|  |       }) | ||
|  |     }) | ||
|  |     setEdges(newEdges) | ||
|  |   }, [store]) | ||
|  | 
 | ||
|  |   return { | ||
|  |     handleEdgeCancelRunningStatus, | ||
|  |   } | ||
|  | } |