fix: gallery without sort

This commit is contained in:
Tomáš Mládek 2022-12-22 13:15:20 +01:00
parent e20b4bff38
commit a60fe311d6

View file

@ -35,7 +35,7 @@
} }
}); });
if (resort && changed) sortAttributes(); if (resort && changed) sortEntities();
} }
// Labelling // Labelling
@ -53,7 +53,7 @@
labelListing = query(`(matches (in ${addressesString}) "LBL" ? )`).result; labelListing = query(`(matches (in ${addressesString}) "LBL" ? )`).result;
} }
function sortAttributes() { function sortEntities() {
if (!sort) return; if (!sort) return;
sortedEntities = deduplicatedEntities.concat(); sortedEntities = deduplicatedEntities.concat();
@ -80,14 +80,13 @@
deduplicatedEntities.forEach((address) => { deduplicatedEntities.forEach((address) => {
addSortKeys(address, $labelListing.getObject(address).identify()); addSortKeys(address, $labelListing.getObject(address).identify());
}); });
sortAttributes(); sortEntities();
resort = true; resort = true;
} }
} }
if (!sort) { if (!sort) {
// Since `sortAttributes` also fills `sortedEntities`, we need to run at least once even if we aren't sorting. sortedEntities = entities;
sortAttributes();
} }
</script> </script>