fix(ui): surface worker-offline failures when deleting a task

DeleteTaskAsync had no IsConnected guard, unlike every other worker-dependent
command in DetailsIslandViewModel, so an offline delete was a silent no-op.
WorkerClient.DeleteTaskAsync also only caught HubException, letting the
InvalidOperationException thrown by an inactive hub connection escape into
the unobserved command task and vanish.

Gate DeleteTaskCommand behind CanDeleteTask (Task != null && IsConnected),
re-evaluate it on connection-state changes, widen WorkerClient to catch the
connection-inactive case too, and wrap the ViewModel's call in try/catch as
a second line of defense against a race between the guard and the call.
This commit is contained in:
mika kuns
2026-08-06 14:29:15 +02:00
parent bac8387069
commit a78cc526a6
3 changed files with 59 additions and 3 deletions
+5
View File
@@ -338,6 +338,11 @@ public partial class WorkerClient : ObservableObject, IAsyncDisposable, IWorkerC
{
return (false, ex.Message);
}
catch (InvalidOperationException)
{
// Hub connection is not active (worker offline / not yet connected).
return (false, "Worker is offline. Reconnect and try again.");
}
}
public async Task WakeQueueAsync()