do not reload if already loaded or loading
This commit is contained in:
+19
-14
@@ -75,21 +75,26 @@ class DataTile extends Tile {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
load() {
|
load() {
|
||||||
this.state = TileState.LOADING;
|
if (this.state == TileState.ERROR) {
|
||||||
this.changed();
|
this.state = TileState.IDLE;
|
||||||
|
}
|
||||||
|
if (this.state == TileState.IDLE) {
|
||||||
|
this.state = TileState.LOADING;
|
||||||
|
this.changed();
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
this.loader_()
|
this.loader_()
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
self.data_ = data;
|
self.data_ = data;
|
||||||
self.state = TileState.LOADED;
|
self.state = TileState.LOADED;
|
||||||
self.changed();
|
self.changed();
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
self.error_ = error;
|
self.error_ = error;
|
||||||
self.state = TileState.ERROR;
|
self.state = TileState.ERROR;
|
||||||
self.changed();
|
self.changed();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user