diff --git a/neuralqa/server/ui/src/components/expandview/ExpandView.jsx b/neuralqa/server/ui/src/components/expandview/ExpandView.jsx index f15624f..83502af 100644 --- a/neuralqa/server/ui/src/components/expandview/ExpandView.jsx +++ b/neuralqa/server/ui/src/components/expandview/ExpandView.jsx @@ -17,7 +17,13 @@ class ExpandView extends Component { }; } - componentDidUpdate(prevProps, prevState) {} + componentDidUpdate(prevProps, prevState) { + if (this.props.data !== prevProps.data) { + console.log("things have changed"); + this.removeAllLines(); + this.drawLines(); + } + } updateGraph(data) {} @@ -78,8 +84,11 @@ class ExpandView extends Component { this.blueColor = "#0062ff"; this.greyColor = "#c4c3c3"; + this.drawLines(); + } - for (const ex of this.data.expansions) { + drawLines() { + for (const ex of this.props.data.expansions) { if (ex.expansion) { for (let i = 0; i < ex.expansion.length; i++) { const startId = "term" + ex.token_index; @@ -97,7 +106,7 @@ class ExpandView extends Component { } render() { - const expansionTermsList = this.data.expansions.map( + const expansionTermsList = this.props.data.expansions.map( (expansionData, index) => { const terms = (expansionData.expansion || []).map((data, index) => { return ( diff --git a/neuralqa/server/ui/src/components/queryview/QueryView.jsx b/neuralqa/server/ui/src/components/queryview/QueryView.jsx index b22ed46..4fbe8ae 100644 --- a/neuralqa/server/ui/src/components/queryview/QueryView.jsx +++ b/neuralqa/server/ui/src/components/queryview/QueryView.jsx @@ -320,7 +320,7 @@ class QueryView extends Component { console.log(data); // let explanationHolder = this.state.explanations; // explanationHolder[selectedAnswerId] = data; - this.setState({ expansion: data }); + this.setState({ expansions: data }); // console.log(data); // setTimeout(() => { // this.setState({ answerIsLoading: false });