From e3f02a475f70cb9ffccc07e16b1a575b4181fcdf Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Mon, 16 Dec 2024 18:03:45 +0100 Subject: [PATCH] feat: load all datalayers in parallel --- umap/static/umap/js/modules/umap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/modules/umap.js b/umap/static/umap/js/modules/umap.js index 664d8ea0..46d4c56f 100644 --- a/umap/static/umap/js/modules/umap.js +++ b/umap/static/umap/js/modules/umap.js @@ -570,9 +570,11 @@ export default class Umap extends ServerStored { } this.datalayersLoaded = true this.fire('datalayersloaded') + const toLoad = [] for (const datalayer of this.datalayersIndex) { - if (datalayer.showAtLoad()) await datalayer.show() + if (datalayer.showAtLoad()) toLoad.push(datalayer.show()) } + await Promise.all(toLoad) this.dataloaded = true this.fire('dataloaded') }