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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user