From 086e43e58469e7dba0fb2443b241ca1f68f2fe17 Mon Sep 17 00:00:00 2001 From: David Baker Date: Sat, 25 Jan 2020 21:30:42 +0000 Subject: [PATCH] comments ftw --- src/components/structures/ToastContainer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/structures/ToastContainer.js b/src/components/structures/ToastContainer.js index 298c40e825..283fbdd96a 100644 --- a/src/components/structures/ToastContainer.js +++ b/src/components/structures/ToastContainer.js @@ -24,6 +24,10 @@ export default class ToastContainer extends React.Component { super(); this.state = {toasts: ToastStore.sharedInstance().getToasts()}; + // Start listening here rather than in componentDidMount because + // toasts may dismiss themselves in their didMount if they find + // they're already irrelevant by the time they're mounted, and + // our own componentDidMount is too late. ToastStore.sharedInstance().on('update', this._onToastStoreUpdate); }