Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not load all datalayers at once #2402

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: do not load all datalayers at once
Some maps have dozens, even hundreds of layers

Co-authored-by: David Larlet <[email protected]>
yohanboniface and davidbgk committed Dec 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f7b4cb252dd362948f6313a84eb5e38069b49607
8 changes: 6 additions & 2 deletions umap/static/umap/js/modules/umap.js
Original file line number Diff line number Diff line change
@@ -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')
}