nit
This commit is contained in:
@@ -190,7 +190,16 @@ export function useRenderingNodeState(
|
||||
const manualRunTriggerSyncedRef = useRef(false)
|
||||
|
||||
const pathCtx = useContext(ConnectionPathContext)
|
||||
const pathCtxRef = useRef(pathCtx)
|
||||
pathCtxRef.current = pathCtx
|
||||
const triggerNodeIds = pathCtx?.connectionPathTriggerNodeIds ?? []
|
||||
|
||||
const updateDataRef = useRef(updateData)
|
||||
updateDataRef.current = updateData
|
||||
const setNodesRef = useRef(setNodes)
|
||||
setNodesRef.current = setNodes
|
||||
const aiConnectionRef = useRef(aiConnection)
|
||||
aiConnectionRef.current = aiConnection
|
||||
const hasPendingInputs =
|
||||
effectiveUpdateMode === 'manual' &&
|
||||
!loading &&
|
||||
@@ -256,6 +265,7 @@ export function useRenderingNodeState(
|
||||
let cancelled = false
|
||||
|
||||
const run = async () => {
|
||||
pathCtxRef.current?.addConnectionPathTrigger?.(id)
|
||||
loadingStartedAtRef.current = Date.now()
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
@@ -263,7 +273,7 @@ export function useRenderingNodeState(
|
||||
setResolvedContent(null)
|
||||
setStreamingMarkdown(null)
|
||||
setReasoningContent('')
|
||||
updateData({
|
||||
updateDataRef.current({
|
||||
cachedRenderedContent: undefined,
|
||||
cachedResolvedContent: undefined,
|
||||
cachedReasoningContent: undefined,
|
||||
@@ -278,8 +288,8 @@ export function useRenderingNodeState(
|
||||
renderNodeId: id,
|
||||
viewportWidth,
|
||||
viewportHeight,
|
||||
setNodes: setNodes ?? undefined,
|
||||
aiConnection,
|
||||
setNodes: setNodesRef.current ?? undefined,
|
||||
aiConnection: aiConnectionRef.current,
|
||||
...(isAgentSource && {
|
||||
onStreamingStart: () => setStreamingMarkdown(''),
|
||||
onStreamingChunk: (chunk: string) =>
|
||||
@@ -297,7 +307,7 @@ export function useRenderingNodeState(
|
||||
if (thisRunId !== runIdRef.current) return
|
||||
setRenderedContent(htmlOrSvg)
|
||||
setError(null)
|
||||
updateData({
|
||||
updateDataRef.current({
|
||||
cachedRenderedContent: htmlOrSvg,
|
||||
cachedResolvedContent: resolved,
|
||||
cachedReasoningContent: reasoning ?? '',
|
||||
@@ -351,26 +361,18 @@ export function useRenderingNodeState(
|
||||
minLoadingTimeoutRef.current = null
|
||||
}
|
||||
}
|
||||
// Content updates only when connected-node data changes (sourceSignature) or explicit run/viewport.
|
||||
// React Flow updates (position, selection, context ref churn) do not trigger re-runs.
|
||||
}, [
|
||||
id,
|
||||
srcId,
|
||||
srcNode?.type,
|
||||
effectiveUpdateMode,
|
||||
runTrigger,
|
||||
sourceContent,
|
||||
sourceSignature,
|
||||
configSignature,
|
||||
edgesSignature,
|
||||
variablesSignature,
|
||||
functionsSignature,
|
||||
dataSignature,
|
||||
viewportWidth,
|
||||
viewportHeight,
|
||||
retryCount,
|
||||
updateData,
|
||||
setNodes,
|
||||
aiConnection,
|
||||
isAgentSource,
|
||||
incomingIds.length,
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user