Skip to content

Instantly share code, notes, and snippets.

@juanlatorre
Created October 29, 2020 01:30
Show Gist options
  • Save juanlatorre/2a5f3957bb8510f29749f2dc3e7b899f to your computer and use it in GitHub Desktop.
Save juanlatorre/2a5f3957bb8510f29749f2dc3e7b899f to your computer and use it in GitHub Desktop.

Revisions

  1. juanlatorre created this gist Oct 29, 2020.
    35 changes: 35 additions & 0 deletions @chakra-ui+toast+1.0.0-rc.7.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    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)
    });
    });
    });