Created
October 29, 2020 01:30
-
-
Save juanlatorre/2a5f3957bb8510f29749f2dc3e7b899f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js b/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js | |
index f64ed90..af3e367 100644 | |
--- a/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js | |
+++ b/node_modules/@chakra-ui/toast/dist/esm/toast-manager.js | |
@@ -119,9 +119,18 @@ export class ToastManager extends React.Component { | |
var position = getToastPosition(prevState, id); | |
if (!position) return prevState; | |
return _extends({}, prevState, { | |
- [position]: prevState[position].map(toast => _extends({}, toast, { | |
- requestClose: toast.id === id ? true : toast.requestClose | |
- })) | |
+ [position]: prevState[position].map((toast) => { | |
+ // id may be string or number | |
+ // eslint-disable-next-line eqeqeq | |
+ if (toast.id == id) { | |
+ return { | |
+ ...toast, | |
+ requestClose: true, | |
+ } | |
+ } | |
+ | |
+ return toast | |
+ }), | |
}); | |
}); | |
}); | |
@@ -129,7 +138,7 @@ export class ToastManager extends React.Component { | |
_defineProperty(this, "removeToast", (id, position) => { | |
this.setState(prevState => { | |
return _extends({}, prevState, { | |
- [position]: prevState[position].filter(toast => toast.id !== id) | |
+ [position]: prevState[position].filter(toast => toast.id != id) | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment