mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
alerts/sagas: avoid reentrancy for dismiss
This fixes react complaining about calling setState from an invalid context.
This commit is contained in:
+3
-1
@@ -35,7 +35,9 @@ function* handleShowAlert(action: ReturnType<typeof alertsShowAlert>): Generator
|
||||
try {
|
||||
const alertAction = yield* take(chan);
|
||||
// the dismiss actions will have called this already, but other actions don't
|
||||
toaster.dismiss(key);
|
||||
if (alertAction !== 'dismiss') {
|
||||
toaster.dismiss(key);
|
||||
}
|
||||
|
||||
yield* put(alertsDidShowAlert(action.domain, action.specific, alertAction));
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user