Skip to content

Commit 9343302

Browse files
committed
alerts/sagas: avoid reentrancy for dismiss
This fixes react complaining about calling setState from an invalid context.
1 parent e6782cb commit 9343302

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/alerts/sagas.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ function* handleShowAlert(action: ReturnType<typeof alertsShowAlert>): Generator
3535
try {
3636
const alertAction = yield* take(chan);
3737
// the dismiss actions will have called this already, but other actions don't
38-
toaster.dismiss(key);
38+
if (alertAction !== 'dismiss') {
39+
toaster.dismiss(key);
40+
}
3941

4042
yield* put(alertsDidShowAlert(action.domain, action.specific, alertAction));
4143
} finally {

0 commit comments

Comments
 (0)