From b16f068a4d87ffe37ca9f98c92989661784c1a36 Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 23 Mar 2018 15:14:18 -0700 Subject: [PATCH 1/6] Prevent props change from affecting local state --- ui/src/shared/components/MultiSelectDropdown.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ui/src/shared/components/MultiSelectDropdown.js b/ui/src/shared/components/MultiSelectDropdown.js index c54a404e5..987d6d4e5 100644 --- a/ui/src/shared/components/MultiSelectDropdown.js +++ b/ui/src/shared/components/MultiSelectDropdown.js @@ -39,14 +39,6 @@ class MultiSelectDropdown extends Component { this.setState({isOpen: false}) } - componentWillReceiveProps(nextProps) { - if (!_.isEqual(this.props.selectedItems, nextProps.selectedItems)) { - return - } - - this.setState({localSelectedItems: nextProps.selectedItems}) - } - toggleMenu = e => { e.stopPropagation() this.setState({isOpen: !this.state.isOpen}) From 29fefc46723e7e41bc09e86484c35e9170063247 Mon Sep 17 00:00:00 2001 From: Alex P Date: Fri, 23 Mar 2018 15:14:27 -0700 Subject: [PATCH 2/6] Simplify logic --- ui/src/shared/components/MultiSelectDropdown.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ui/src/shared/components/MultiSelectDropdown.js b/ui/src/shared/components/MultiSelectDropdown.js index 987d6d4e5..81c7b96cc 100644 --- a/ui/src/shared/components/MultiSelectDropdown.js +++ b/ui/src/shared/components/MultiSelectDropdown.js @@ -98,17 +98,16 @@ class MultiSelectDropdown extends Component { renderMenu() { const {items, isApplyShown} = this.props - const applyButton = isApplyShown ? ( -
  • - -
  • - ) : null return (