Fix: await 'country' to be loaded

This commit is contained in:
Pieter Vander Vennet 2023-07-18 01:53:37 +02:00
parent e3a73d551a
commit 3c5bde1ae3
6 changed files with 102 additions and 35 deletions

View file

@ -590,11 +590,13 @@ export default class SimpleMetaTaggers {
doc: "Adds the currency valid for the object, based on country or explicit tagging. Can be a single currency or a semicolon-separated list of currencies. Empty if no currency is found.",
isLazy: true,
},
(feature) => {
Utils.AddLazyProperty(feature.properties, "_currency", () => {
(feature: Feature, layer: LayerConfig, tagsStore: UIEventSource<OsmTags>) => {
Utils.AddLazyPropertyAsync(feature.properties, "_currency", async () => {
// Wait until _country is actually set
await tagsStore.AsPromise((tags) => !!tags._country)
// Initialize a list of currencies
const currencies = {}
// Check if there are any currency:XXX tags, add them to the map
for (const key in feature.properties) {
if (key.startsWith("currency:")) {