Skip to content

Commit 57859b0

Browse files
committed
Fix property display
1 parent f1267fc commit 57859b0

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

lib/components/field.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/components/field.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/components/select.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/components/select.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/field.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,30 @@ import nestedProperty from "plotly.js/src/lib/nested_property";
55
class Field extends Component {
66
constructor(props, context) {
77
super(props);
8+
89
this._index = context.traceIndex;
910
this._data = context.data[this._index];
1011
this._fullData = context.fullData[this._index];
1112
this._property = nestedProperty(this._data, this.props.attr);
1213
this._fullProperty = nestedProperty(this._fullData, this.props.attr);
1314
this.updatePlot = this.updatePlot.bind(this);
1415
this._contextUpdate = context.handleUpdate;
16+
17+
this.state = {
18+
value: this.fullValue,
19+
};
1520
}
1621

1722
componentWillReceiveProps(nextProps, nextContext) {
1823
this._index = nextContext.traceIndex;
1924
this._contextUpdate = nextContext.handleUpdate;
25+
2026
if (nextContext.data) {
2127
this._data = nextContext.data[this._index];
2228
} else {
2329
this._data = [];
2430
}
31+
2532
if (nextContext.fullData) {
2633
this._fullData = nextContext.fullData[this._index];
2734
} else {
@@ -31,6 +38,7 @@ class Field extends Component {
3138

3239
updatePlot(event) {
3340
this.value = event.target.value;
41+
this.setState({ value: event.target.value });
3442
this._contextUpdate && this._contextUpdate(this.props.attr, this.value);
3543
}
3644

src/components/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Select extends Field {
1818
</span>
1919

2020
<select
21-
value={this.props.fullValue}
21+
value={this.state.value}
2222
className="field-control"
2323
onChange={this.updatePlot}
2424
>

0 commit comments

Comments
 (0)