Skip to content

Commit

Permalink
fix problem with stall suggestions from previous field
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Feb 12, 2020
1 parent b02dbab commit 6bf86a3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const ColorStopsCategorical = ({

return (
<StopInput
key={field.getName()} // force new component instance when field changes
field={field}
getValueSuggestions={getValueSuggestions}
value={stopValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ export class StopInput extends Component {

componentDidMount() {
this._isMounted = true;
this._prevFieldName = undefined;
this._loadFieldDataType();
}

componentDidUpdate() {
this._loadFieldDataType();
}

Expand All @@ -37,11 +32,6 @@ export class StopInput extends Component {
}

async _loadFieldDataType() {
if (this.props.field.getName() === this._prevFieldName) {
return;
}

this._prevFieldName = this.props.field.getName();
const fieldDataType = await this.props.field.getDataType();
if (this._isMounted) {
this.setState({ fieldDataType });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export function IconStops({
/>
) : (
<StopInput
key={field.getName()} // force new component instance when field changes
field={field}
getValueSuggestions={getValueSuggestions}
value={stop}
Expand Down

0 comments on commit 6bf86a3

Please sign in to comment.