Merge pull request #1458 from umap-project/fix-datachanged

Make sure DataLayer._dataloaded is set only once all data is imported
This commit is contained in:
Yohan Boniface 2023-12-12 10:20:54 +01:00 committed by GitHub
commit 8ce09b039f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -665,7 +665,6 @@ L.U.DataLayer = L.Evented.extend({
this.backupOptions() this.backupOptions()
this.fire('loaded') this.fire('loaded')
this._loading = false this._loading = false
this._dataloaded = true
}, },
context: this, context: this,
}) })
@ -674,6 +673,7 @@ L.U.DataLayer = L.Evented.extend({
fromGeoJSON: function (geojson) { fromGeoJSON: function (geojson) {
this.addData(geojson) this.addData(geojson)
this._geojson = geojson this._geojson = geojson
this._dataloaded = true
this.fire('dataloaded') this.fire('dataloaded')
this.fire('datachanged') this.fire('datachanged')
}, },
@ -730,7 +730,6 @@ L.U.DataLayer = L.Evented.extend({
verb: 'GET', verb: 'GET',
callback: (raw) => { callback: (raw) => {
this.clear() this.clear()
this._dataloaded = true
this.rawToGeoJSON(raw, this.options.remoteData.format, (geojson) => this.rawToGeoJSON(raw, this.options.remoteData.format, (geojson) =>
this.fromGeoJSON(geojson) this.fromGeoJSON(geojson)
) )