diff --git a/app/src/frontend/building/data-components/multi-data-entry.tsx b/app/src/frontend/building/data-components/multi-data-entry.tsx index 6a0a91a9..9932b803 100644 --- a/app/src/frontend/building/data-components/multi-data-entry.tsx +++ b/app/src/frontend/building/data-components/multi-data-entry.tsx @@ -32,24 +32,28 @@ class MultiDataEntry extends Component return this.props.value == undefined ? [] : this.props.value; } + cloneValues() { + return this.getValues().slice(); + } + setNewValue(value: string) { this.setState({newValue: value}); } edit(index: number, value: string) { - let values = this.getValues(); + let values = this.cloneValues(); values.splice(index, 1, value); this.props.onChange(this.props.slug, values); } addNew(event) { event.preventDefault(); - const values = this.getValues().concat(this.state.newValue); + const values = this.cloneValues().concat(this.state.newValue); this.setState({newValue: ''}); this.props.onChange(this.props.slug, values); } remove(index: number){ - const values = this.getValues(); + const values = this.cloneValues(); values.splice(index, 1); this.props.onChange(this.props.slug, values); }