diff --git a/CHANGELOG.md b/CHANGELOG.md index edbf8a97..afd8b0c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ Thanks to all contributers who improved notistack by opening an issue/PR. -### `notistack@0.9.15` +### `notistack@0.9.16` ###### to be published * **@pctestjfarz**: Add swipe to dismiss feature [#138](https://github.com/iamhosseindhv/notistack/issues/138) * **@molynerd**: Add support to update content of snackbar in place [#50](https://github.com/iamhosseindhv/notistack/issues/50) @@ -8,6 +8,14 @@ Thanks to all contributers who improved notistack by opening an issue/PR. +
+ + +### `notistack@0.9.15` +###### May 17, 2020 +* **@nebojsanb**: Fix bug with displaying snackbars [#270](https://github.com/iamhosseindhv/notistack/issues/270) + +
diff --git a/src/SnackbarProvider.tsx b/src/SnackbarProvider.tsx index e44f68c4..fc9afaf8 100644 --- a/src/SnackbarProvider.tsx +++ b/src/SnackbarProvider.tsx @@ -171,6 +171,10 @@ class SnackbarProvider extends Component { * Set the entered state of the snackbar with the given key. */ handleEnteredSnack: TransitionHandlerProps['onEntered'] = (node, isAppearing, key) => { + if (!key) { + throw new Error('handleEnteredSnack Cannot be called with undefined key'); + } + this.setState(({ snacks }) => ({ snacks: snacks.map(item => ( item.key === key ? { ...item, entered: true } : { ...item } @@ -223,7 +227,13 @@ class SnackbarProvider extends Component { * waiting in the queue (if any). If after this process the queue is not empty, the * oldest message is dismissed. */ - handleExitedSnack: TransitionHandlerProps['onExited'] = (event, key) => { + // @ts-ignore + handleExitedSnack: TransitionHandlerProps['onExited'] = (event, key1, key2) => { + const key = key1 || key2; + if (!key) { + throw new Error('handleExitedSnack Cannot be called with undefined key'); + } + this.setState((state) => { const newState = this.processQueue({ ...state,