diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js index bd6933ac2..cb5ef1594 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js @@ -32,7 +32,6 @@ function AdvancedMultiSelectHeader(props) { class AdvancedMultiSelect extends React.Component { constructor(props) { super(props); - let selectedPluginNames = this.props.value.map(v => v.name); let allPluginNames = this.props.options.enumOptions.map(v => v.value); @@ -162,6 +161,16 @@ class AdvancedMultiSelect extends React.Component { this.onChange(safePluginNames); } + static getDerivedStateFromProps(props, current_state) { + let propsPluginNames = props.value.map(v => v.name); + if (current_state.selectedPluginNames !== propsPluginNames) { + return { + selectedPluginNames: propsPluginNames + } + } + return null + } + render() { const { autofocus,