Skip to content

Commit ca79bc8

Browse files
authored
Mariano/agent 5 (#1921)
* refactor(hooks): ensure onComplete is always called after execution
1 parent bcfc81a commit ca79bc8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/hooks/useBrowserExecution.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ export function useBrowserExecution({
6868
} else {
6969
toast.error(execRes.data?.error || 'Automation failed');
7070
}
71-
72-
onComplete();
7371
} catch (err) {
7472
toast.error(err instanceof Error ? err.message : 'Failed to run automation');
7573
} finally {
@@ -91,6 +89,10 @@ export function useBrowserExecution({
9189
// Ignore cleanup errors (don't block UI / don't mask original error)
9290
}
9391
}
92+
93+
// Always refresh after any run attempt (success/failure/exception) so the UI doesn't
94+
// get stuck showing the old "running" run until a full page refresh.
95+
onComplete();
9496
}
9597
},
9698
[organizationId, onNeedsReauth, onComplete],

0 commit comments

Comments
 (0)