]> cat aescling's git repositories - mastodon.git/commitdiff
Update state when opened dropdown is unmounted (fixes #8397) (#8398)
authorThibG <thib@sitedethib.com>
Thu, 23 Aug 2018 18:43:27 +0000 (20:43 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 23 Aug 2018 18:43:27 +0000 (20:43 +0200)
app/javascript/mastodon/components/dropdown_menu.js

index e83f724e9e9ef01470a35cff3d8f569d27cac7b9..a5cf6479b0e3b13b8b0ac0cd9d2fb5a0185034fe 100644 (file)
@@ -226,6 +226,12 @@ export default class Dropdown extends React.PureComponent {
     return this.target;
   }
 
+  componentWillUnmount = () => {
+    if (this.state.id === this.props.openDropdownId) {
+      this.handleClose();
+    }
+  }
+
   render () {
     const { icon, items, size, title, disabled, dropdownPlacement, openDropdownId } = this.props;
     const open = this.state.id === openDropdownId;