Test that data tiles can be loaded after error

This commit is contained in:
Tim Schaub
2022-04-27 14:50:33 -06:00
parent 0ef7c40b8e
commit 5084d5566a
2 changed files with 36 additions and 21 deletions
+16 -18
View File
@@ -75,26 +75,24 @@ class DataTile extends Tile {
* @api
*/
load() {
if (this.state == TileState.ERROR) {
this.state = TileState.IDLE;
if (this.state !== TileState.IDLE && this.state !== TileState.ERROR) {
return;
}
if (this.state == TileState.IDLE) {
this.state = TileState.LOADING;
this.changed();
this.state = TileState.LOADING;
this.changed();
const self = this;
this.loader_()
.then(function (data) {
self.data_ = data;
self.state = TileState.LOADED;
self.changed();
})
.catch(function (error) {
self.error_ = error;
self.state = TileState.ERROR;
self.changed();
});
}
const self = this;
this.loader_()
.then(function (data) {
self.data_ = data;
self.state = TileState.LOADED;
self.changed();
})
.catch(function (error) {
self.error_ = error;
self.state = TileState.ERROR;
self.changed();
});
}
}