From 5bcb879dfe7e3005923bb2357fd7595edb8fb10c Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Sun, 3 Oct 2021 01:57:36 +0200 Subject: [PATCH] Fix local caching by hiding latlon2country import --- Logic/MetaTagging.ts | 4 ++-- Logic/Osm/OsmObject.ts | 1 - Logic/SimpleMetaTagger.ts | 6 +----- UI/WikipediaBox.ts | 1 + index.ts | 5 ++++- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Logic/MetaTagging.ts b/Logic/MetaTagging.ts index ee4209f4ae..47d7f8a357 100644 --- a/Logic/MetaTagging.ts +++ b/Logic/MetaTagging.ts @@ -77,7 +77,7 @@ export default class MetaTagging { } if(somethingChanged){ - State.state.allElements.getEventSourceById(feature.properties.id).ping() + State.state?.allElements?.getEventSourceById(feature.properties.id)?.ping() } } } @@ -150,7 +150,7 @@ export default class MetaTagging { for (const f of functions) { f(params, feature); } - State.state.allElements.getEventSourceById(feature.properties.id).ping(); + State.state?.allElements?.getEventSourceById(feature.properties.id)?.ping(); } catch (e) { console.error("While calculating a tag value: ", e) } diff --git a/Logic/Osm/OsmObject.ts b/Logic/Osm/OsmObject.ts index 4538622d12..9c1efbae98 100644 --- a/Logic/Osm/OsmObject.ts +++ b/Logic/Osm/OsmObject.ts @@ -177,7 +177,6 @@ export abstract class OsmObject { private static constructPolygonFeatures(): Map, blacklist: boolean }> { const result = new Map, blacklist: boolean }>(); - for (const polygonFeature of polygon_features) { const key = polygonFeature.key; diff --git a/Logic/SimpleMetaTagger.ts b/Logic/SimpleMetaTagger.ts index 360bb54e5a..eb1a6a49d8 100644 --- a/Logic/SimpleMetaTagger.ts +++ b/Logic/SimpleMetaTagger.ts @@ -1,15 +1,11 @@ import {GeoOperations} from "./GeoOperations"; import State from "../State"; -import {And} from "./Tags/And"; -import {Tag} from "./Tags/Tag"; -import {Or} from "./Tags/Or"; import {Utils} from "../Utils"; import opening_hours from "opening_hours"; import Combine from "../UI/Base/Combine"; import BaseUIElement from "../UI/BaseUIElement"; import Title from "../UI/Base/Title"; import {FixedUiElement} from "../UI/Base/FixedUiElement"; -import CountryCoder from "latlon2country/index"; const cardinalDirections = { @@ -21,7 +17,7 @@ const cardinalDirections = { export default class SimpleMetaTagger { - private static coder: CountryCoder = new CountryCoder("https://pietervdvn.github.io/latlon2country/"); + public static coder: any; public static readonly objectMetaInfo = new SimpleMetaTagger( { keys: ["_last_edit:contributor", diff --git a/UI/WikipediaBox.ts b/UI/WikipediaBox.ts index af3e27c7e4..7f0d392a60 100644 --- a/UI/WikipediaBox.ts +++ b/UI/WikipediaBox.ts @@ -66,6 +66,7 @@ export default class WikipediaBox extends Toggle { new Combine([Svg.wikipedia_ui().SetStyle("width: 1.5rem").SetClass("mr-3"), new Title(Translations.t.general.wikipedia.wikipediaboxTitle.Clone(), 2)]).SetClass("flex"), contents]).SetClass("block rounded-xl subtle-background m-1 p-2 flex flex-col") + .SetStyle("max-height: inherit") super( mainContent, undefined, diff --git a/index.ts b/index.ts index 0614e40a2b..1e98ae890b 100644 --- a/index.ts +++ b/index.ts @@ -13,11 +13,14 @@ import AvailableBaseLayers from "./Logic/Actors/AvailableBaseLayers"; import LayoutConfig from "./Models/ThemeConfig/LayoutConfig"; import Constants from "./Models/Constants"; import MinimapImplementation from "./UI/Base/MinimapImplementation"; +import CountryCoder from "latlon2country/index"; +import SimpleMetaTagger from "./Logic/SimpleMetaTagger"; MinimapImplementation.initialize() // Workaround for a stupid crash: inject some functions which would give stupid circular dependencies or crash the other nodejs scripts ValidatedTextField.bestLayerAt = (location, layerPref) => AvailableBaseLayers.SelectBestLayerAccordingTo(location, layerPref) - + + SimpleMetaTagger.coder = new CountryCoder("https://pietervdvn.github.io/latlon2country/"); let defaultLayout = "" // --------------------- Special actions based on the parameters -----------------