fix: race condition tools approval state (#5259)

This commit is contained in:
Faisal Amir 2025-06-12 18:51:42 +07:00 committed by GitHub
parent 414a9f0da5
commit 32f68de36f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,13 @@ export const useToolApproval = create<ToolApprovalState>()(
showApprovalModal: (toolName: string, threadId: string) => {
return new Promise<boolean>((resolve) => {
// Check if tool is already approved for this thread
const state = get()
if (state.isToolApproved(threadId, toolName)) {
resolve(true)
return
}
set({
isModalOpen: true,
modalProps: {