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: make print legend layer order match legend layer order #2059

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions src/controls/print/print-legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ const LayerRows = function LayerRows(options) {
});
const layerListCmp = Component({
async render() {
const content = await overlayEls.reduce(async (acc, item) => await acc + await item.render(), '');
return `<ul id="${this.getId()}" class="list">${content}</ul>`;
const rowPromises = overlayEls.map((item) => item.render());
const rows = await Promise.all(rowPromises);
return `<ul id="${this.getId()}" class="list">${rows.reverse()}</ul>`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implicit rows.reverse().toString() introduces an extra comma as it calls string.join() with comma as separator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted

}
});
return `
Expand Down
Loading