mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
fix: do not load all datalayers at once
Some maps have dozens, even hundreds of layers Co-authored-by: David Larlet <david@larlet.fr>
This commit is contained in:
parent
49d1dbf36e
commit
f7b4cb252d
1 changed files with 6 additions and 2 deletions
|
@ -581,9 +581,13 @@ export default class Umap extends ServerStored {
|
|||
this.fire('datalayersloaded')
|
||||
const toLoad = []
|
||||
for (const datalayer of this.datalayersIndex) {
|
||||
if (datalayer.showAtLoad()) toLoad.push(datalayer.show())
|
||||
if (datalayer.showAtLoad()) toLoad.push(() => datalayer.show())
|
||||
}
|
||||
await Promise.all(toLoad)
|
||||
while (toLoad.length) {
|
||||
const chunk = toLoad.splice(0, 10)
|
||||
await Promise.all(chunk.map((func) => func()))
|
||||
}
|
||||
|
||||
this.dataloaded = true
|
||||
this.fire('dataloaded')
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue