Skip to content

Commit

Permalink
Prevent unnecessary xy requests while analysis is running
Browse files Browse the repository at this point in the history
In componentDidUpdate(), do not trigger a xy request if the previous
outputStatus was running, only trigger it if the outputStatus changed.
This will trigger it only once, when the analysis is completed.

Fixes #691

Signed-off-by: Patrick Tasse <patrick.tasse@ericsson.com>
  • Loading branch information
PatrickTasse committed Mar 8, 2022
1 parent b4855ec commit 10ec121
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ export class XYOutputComponent extends AbstractTreeOutputComponent<AbstractOutpu
const checkedSeriesChanged = this.state.checkedSeries !== prevState.checkedSeries;
const collapsedNodesChanged = this.state.collapsedNodes !== prevState.collapsedNodes;
const chartWidthChanged = this.props.style.width !== prevProps.style.width || this.props.style.chartOffset !== prevProps.style.chartOffset;
const needToUpdate = viewRangeChanged || checkedSeriesChanged || collapsedNodesChanged || chartWidthChanged;
if (needToUpdate || prevState.outputStatus === ResponseStatus.RUNNING) {
const outputStatusChanged = this.state.outputStatus !== prevState.outputStatus;
const needToUpdate = viewRangeChanged || checkedSeriesChanged || collapsedNodesChanged || chartWidthChanged || outputStatusChanged;
if (needToUpdate) {
this.updateXY();
}
if (this.chartRef.current) {
Expand Down

0 comments on commit 10ec121

Please sign in to comment.