Merge pull request #3943 from matrix-org/dbkr/kill_lingering_verification_toast
Stop rogue verification toast if you verify during loginpull/21833/head
						commit
						1ab91d1d74
					
				|  | @ -23,9 +23,11 @@ export default class ToastContainer extends React.Component { | |||
|     constructor() { | ||||
|         super(); | ||||
|         this.state = {toasts: ToastStore.sharedInstance().getToasts()}; | ||||
|     } | ||||
| 
 | ||||
|     componentDidMount() { | ||||
|         // 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); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -39,6 +39,13 @@ export default class VerificationRequestToast extends React.PureComponent { | |||
|             this.setState({counter}); | ||||
|         }, 1000); | ||||
|         request.on("change", this._checkRequestIsPending); | ||||
|         // We should probably have a separate class managing the active verification toasts,
 | ||||
|         // rather than monitoring this in the toast component itself, since we'll get problems
 | ||||
|         // like the toasdt not going away when the verification is cancelled unless it's the
 | ||||
|         // one on the top (ie. the one that's mounted).
 | ||||
|         // As a quick & dirty fix, check the toast is still relevant when it mounts (this prevents
 | ||||
|         // a toast hanging around after logging in if you did a verification as part of login).
 | ||||
|         this._checkRequestIsPending(); | ||||
|     } | ||||
| 
 | ||||
|     componentWillUnmount() { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 David Baker
						David Baker