From 0d0e366cba034ded488aafffb30b50d88657b057 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sun, 4 Jan 2026 02:51:21 +0000 Subject: [PATCH] firmware/sagas: fix progress toasts not being removed on error Add some calls to hide the progress toasts when an error occurs during firmware flashing. Without this, the toasts would remain visible even after the error alert was shown. --- src/firmware/sagas.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/firmware/sagas.ts b/src/firmware/sagas.ts index f62d17e0..be910740 100644 --- a/src/firmware/sagas.ts +++ b/src/firmware/sagas.ts @@ -1037,6 +1037,7 @@ function* handleRestoreOfficialDfu( } } +const firmwareEv3ProgressToastId = 'firmware.ev3.progress'; const getNextEV3MessageId = createCountFunc(); function* handleFlashEV3(action: ReturnType): Generator { @@ -1256,6 +1257,7 @@ function* handleFlashEV3(action: ReturnType): Generator error: eraseError, }), ); + yield* put(alertsHideAlert(firmwareEv3ProgressToastId)); // FIXME: should have a better error reason yield* put(didFailToFinish(FailToFinishReasonType.Unknown, eraseError)); yield* put(firmwareDidFailToFlashEV3()); @@ -1273,6 +1275,7 @@ function* handleFlashEV3(action: ReturnType): Generator error: sendError, }), ); + yield* put(alertsHideAlert(firmwareEv3ProgressToastId)); // FIXME: should have a better error reason yield* put(didFailToFinish(FailToFinishReasonType.Unknown, sendError)); yield* put(firmwareDidFailToFlashEV3()); @@ -1289,7 +1292,7 @@ function* handleFlashEV3(action: ReturnType): Generator action: 'flash', progress: (i + sectorData.byteLength) / action.firmware.byteLength, }, - firmwareBleProgressToastId, + firmwareEv3ProgressToastId, true, ), ); @@ -1303,7 +1306,7 @@ function* handleFlashEV3(action: ReturnType): Generator action: 'flash', progress: 1, }, - firmwareBleProgressToastId, + firmwareEv3ProgressToastId, true, ), );