mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(control-bar): fix race condition for displaying notification & running state
This commit is contained in:
@@ -331,6 +331,9 @@ export function ControlBar() {
|
||||
setIsMultiRunning(true)
|
||||
setShowRunProgress(runCount > 1)
|
||||
|
||||
let result = null
|
||||
let workflowError = null
|
||||
|
||||
try {
|
||||
// Run the workflow multiple times sequentially
|
||||
for (let i = 0; i < runCount; i++) {
|
||||
@@ -351,14 +354,19 @@ export function ControlBar() {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
workflowError = error
|
||||
logger.error('Error during multiple workflow runs:', { error })
|
||||
addNotification('error', 'Failed to complete all workflow runs', activeWorkflowId)
|
||||
} finally {
|
||||
setIsMultiRunning(false)
|
||||
// Keep progress visible for a moment after completion
|
||||
if (runCount > 1) {
|
||||
setTimeout(() => setShowRunProgress(false), 2000)
|
||||
}
|
||||
|
||||
// Show notification after state is updated
|
||||
if (workflowError) {
|
||||
addNotification('error', 'Failed to complete all workflow runs', activeWorkflowId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Generated
+946
-1064
File diff suppressed because it is too large
Load Diff
@@ -45,15 +45,10 @@ export const userTool: ToolConfig<XUserParams, XUserResponse> = {
|
||||
},
|
||||
|
||||
transformResponse: async (response, params) => {
|
||||
if (!params) {
|
||||
throw new Error('Missing required parameters')
|
||||
}
|
||||
|
||||
// Handle rate limit issues (429 status code)
|
||||
if (response.status === 429) {
|
||||
logger.warn('X API rate limit exceeded', {
|
||||
status: response.status,
|
||||
username: params.username,
|
||||
headers: Object.fromEntries(response.headers.entries()),
|
||||
})
|
||||
|
||||
@@ -111,7 +106,6 @@ export const userTool: ToolConfig<XUserParams, XUserResponse> = {
|
||||
logger.error('Error processing X API response', {
|
||||
error,
|
||||
status: response.status,
|
||||
username: params.username,
|
||||
})
|
||||
throw error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user