feat: introdce store
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
* pipeline interface.
|
||||
*/
|
||||
|
||||
import { useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useAbstractNode } from '@/lib/graph/abstractNode'
|
||||
import { ConnectionPathContext } from '@/lib/graph/flowContext'
|
||||
import { useSyncConnectionStatus } from '@/lib/graph/nodeLifecycle'
|
||||
import { useCanvasStore, dispatchCanvasCommand } from '@/app/canvas/canvasStore'
|
||||
import { usePlatform } from '@/app/kosmos/KosmosContext'
|
||||
import { getDefaultDataForType, getNextNodeId } from '@/lib/graph/flowUtils'
|
||||
import { getDefaultStyle } from '@/lib/graph/nodeRegistry'
|
||||
@@ -189,10 +189,7 @@ export function useRenderingNodeState(
|
||||
const lastManualRunTriggerRef = useRef(0)
|
||||
const manualRunTriggerSyncedRef = useRef(false)
|
||||
|
||||
const pathCtx = useContext(ConnectionPathContext)
|
||||
const pathCtxRef = useRef(pathCtx)
|
||||
pathCtxRef.current = pathCtx
|
||||
const triggerNodeIds = pathCtx?.connectionPathTriggerNodeIds ?? []
|
||||
const triggerNodeIds = useCanvasStore((s) => s.path.triggerNodeIds)
|
||||
|
||||
const updateDataRef = useRef(updateData)
|
||||
updateDataRef.current = updateData
|
||||
@@ -265,7 +262,7 @@ export function useRenderingNodeState(
|
||||
let cancelled = false
|
||||
|
||||
const run = async () => {
|
||||
pathCtxRef.current?.addConnectionPathTrigger?.(id)
|
||||
dispatchCanvasCommand({ type: 'path/addTrigger', payload: id })
|
||||
loadingStartedAtRef.current = Date.now()
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
|
||||
Reference in New Issue
Block a user