mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 00:02:19 +00:00
set app button loading state to true before worker execution (#7493)
This commit is contained in:
@@ -167,14 +167,30 @@
|
||||
if (iterContext && listInputs) {
|
||||
listInputs.set(id, inputOutput)
|
||||
}
|
||||
if (preclickAction) {
|
||||
await preclickAction()
|
||||
|
||||
// Set loading state immediately for immediate visual feedback
|
||||
// This ensures the spinner appears right away, even before the API request completes
|
||||
if (runnableComponent) {
|
||||
loading = true
|
||||
}
|
||||
|
||||
if (!runnableComponent) {
|
||||
runnableWrapper?.handleSideEffect(true)
|
||||
} else {
|
||||
await runnableComponent?.runComponent()
|
||||
try {
|
||||
if (preclickAction) {
|
||||
await preclickAction()
|
||||
}
|
||||
|
||||
if (!runnableComponent) {
|
||||
runnableWrapper?.handleSideEffect(true)
|
||||
} else {
|
||||
await runnableComponent?.runComponent()
|
||||
}
|
||||
} catch (error) {
|
||||
// If an error occurs before the job starts, reset loading state
|
||||
// (If the job started, RunnableComponent will handle resetting loading)
|
||||
if (runnableComponent) {
|
||||
loading = false
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -557,6 +557,7 @@
|
||||
let error = e?.body ?? e?.message
|
||||
updateResult({ error })
|
||||
$errorByComponent[id] = { error }
|
||||
loading = false // Ensure loading is reset on any error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user