mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Reorder execution of init.
Set "on" binding before awaiting cache reset. Set "wfslayers" to a empty map immediately on reset.
This commit is contained in:
@@ -307,16 +307,13 @@ function searchLimited(limit, projection, rtree) {
|
||||
export default {
|
||||
|
||||
init: async function () {
|
||||
this.event = utilRebind(this, dispatch, 'on');
|
||||
if (!_vegbilderCache) {
|
||||
await this.reset();
|
||||
}
|
||||
|
||||
this.event = utilRebind(this, dispatch, 'on');
|
||||
},
|
||||
|
||||
reset: async function () {
|
||||
const availableLayers = await fetchAvailableLayers();
|
||||
|
||||
if (_vegbilderCache) {
|
||||
for (const layer of _vegbilderCache.wfslayers.values()) {
|
||||
for (const controller of layer.inflight.values()) {
|
||||
@@ -325,7 +322,16 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
const wfslayers = availableLayers.reduce((wfslayers, layerInfo) => {
|
||||
_vegbilderCache = {
|
||||
wfslayers: new Map(),
|
||||
rtree: new RBush(),
|
||||
image2sequence_map: new Map()
|
||||
};
|
||||
|
||||
const availableLayers = await fetchAvailableLayers();
|
||||
const {wfslayers} = _vegbilderCache;
|
||||
|
||||
for (const layerInfo of availableLayers) {
|
||||
const cache = {
|
||||
layerInfo,
|
||||
loaded: new Map(),
|
||||
@@ -334,17 +340,9 @@ export default {
|
||||
sequences: []
|
||||
};
|
||||
wfslayers.set(layerInfo.name, cache);
|
||||
return wfslayers;
|
||||
}, new Map());
|
||||
|
||||
_vegbilderCache = {
|
||||
wfslayers,
|
||||
rtree: new RBush(),
|
||||
image2sequence_map: new Map()
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
images: function (projection) {
|
||||
const limit = 5;
|
||||
return searchLimited(limit, projection, _vegbilderCache.rtree);
|
||||
|
||||
Reference in New Issue
Block a user