From 8a7b40f04ecbfcd003f275388df0ddc7572dfadf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= <skunk@xover.mud.at>
Date: Thu, 13 Oct 2022 10:22:10 +0200
Subject: [PATCH] Wikidata: twig filter 'wikidataEntity': recalc map feature
 after loading

---
 package.json    | 3 ++-
 src/wikidata.js | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/package.json b/package.json
index f67c9d0a..5c214004 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,8 @@
     "openstreetmap-date-format": "^0.3.1",
     "openstreetmap-date-parser": "^0.1.2",
     "openstreetmap-tag-translations": "git+https://github.com/plepe/openstreetmap-tag-translations.git",
-    "overpass-layer": "^3.1.1",
+    "overpass-frontend": "^2.7.2",
+    "overpass-layer": "^3.2.0",
     "query-string": "^6.13.8",
     "sheet-router": "^4.2.3",
     "sprintf-js": "^1.1.2",
diff --git a/src/wikidata.js b/src/wikidata.js
index 31abfc68..5c0b6035 100644
--- a/src/wikidata.js
+++ b/src/wikidata.js
@@ -44,11 +44,16 @@ module.exports = {
 }
 
 OverpassLayer.twig.extendFilter('wikidataEntity', function (value, param) {
+  const ob = global.currentMapFeature
   if (value in cache) {
     return cache[value]
   }
 
-  wikidataLoad(value, () => {})
+  wikidataLoad(value, () => {
+    if (ob) {
+      ob.recalc()
+    }
+  })
 
   return null
 })