Revert "UI crash due to multiple redundant telemetry requests fix"

This reverts commit 598872af
This commit is contained in:
VakarisZ 2020-05-22 09:42:21 +03:00
parent bda9b04393
commit 04b00b5d88
1 changed files with 3 additions and 8 deletions

View File

@ -23,8 +23,7 @@ class MapPageComponent extends AuthComponent {
telemetryLastTimestamp: null,
isScrolledUp: false,
telemetryLines: 0,
telemetryCurrentLine: 0,
telemetryUpdateInProgress: false
telemetryCurrentLine: 0
};
this.telemConsole = React.createRef();
this.handleScroll = this.handleScroll.bind(this);
@ -73,20 +72,16 @@ class MapPageComponent extends AuthComponent {
};
updateTelemetryFromServer = () => {
if( this.state.telemetryUpdateInProgress ) {
return
}
this.setState({telemetryUpdateInProgress: true});
this.authFetch('/api/telemetry-feed?timestamp=' + this.state.telemetryLastTimestamp)
.then(res => res.json())
.then(res => {
if ('telemetries' in res) {
let newTelem = this.state.telemetry.concat(res['telemetries']);
this.setState(
{
telemetry: newTelem,
telemetryLastTimestamp: res['timestamp'],
telemetryUpdateInProgress: false
telemetryLastTimestamp: res['timestamp']
});
this.props.onStatusChange();