fix(log list): prevent duplicate data fetch (#9190)

This commit is contained in:
-LAN- 2024-10-11 10:32:27 +08:00 committed by GitHub
parent 05c1ef75c4
commit a34891851b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -299,10 +299,14 @@ function DetailPanel<T extends ChatConversationFullDetailResponse | CompletionCo
}))
}, [items])
const fetchInitiated = useRef(false)
useEffect(() => {
if (appDetail?.id && detail.id && appDetail?.mode !== 'completion')
if (appDetail?.id && detail.id && appDetail?.mode !== 'completion' && !fetchInitiated.current) {
fetchInitiated.current = true
fetchData()
}, [appDetail?.id, detail.id, appDetail?.mode])
}
}, [appDetail?.id, detail.id, appDetail?.mode, fetchData])
const isChatMode = appDetail?.mode !== 'completion'
const isAdvanced = appDetail?.mode === 'advanced-chat'