feat: reset metrics on dataset change (#12782)

* reset metrics on dataset change take one

* remove code

* part 2 or reseting adhoc controls

* update input controls and customize defaults

* remove conosles

* remove extra method

* simplify logic for controls reset and have them use their defaults

* remove consoles

* add annotation control to defaultvalues

* remove line
This commit is contained in:
Phillip Kelley-Dotson
2021-02-04 22:08:27 -08:00
committed by GitHub
parent ac3e16d0ac
commit 3bb14ab950
9 changed files with 67 additions and 7 deletions

View File

@@ -82,7 +82,10 @@ const defaultProps = {
export default class SelectControl extends React.PureComponent {
constructor(props) {
super(props);
this.state = { options: this.getOptions(props) };
this.state = {
options: this.getOptions(props),
value: this.props.value,
};
this.onChange = this.onChange.bind(this);
this.createMetaSelectAllOption = this.createMetaSelectAllOption.bind(this);
this.select = null; // pointer to the react-select instance
@@ -240,7 +243,12 @@ export default class SelectControl extends React.PureComponent {
const isMulti = this.props.isMulti || this.props.multi;
let assistiveText;
if (isMulti && optionsRemaining && Array.isArray(value) && !!value.length) {
if (
isMulti &&
optionsRemaining &&
Array.isArray(this.state.value) &&
!!value.length
) {
assistiveText = optionRemaingText;
}
@@ -262,12 +270,12 @@ export default class SelectControl extends React.PureComponent {
onChange: this.onChange,
onFocus,
optionRenderer,
value,
options: this.state.options,
placeholder,
assistiveText,
promptTextCreator,
selectRef: this.getSelectRef,
value,
valueKey,
valueRenderer,
};