Fix: no more duplicate link showing up, avoid crash

This commit is contained in:
Pieter Vander Vennet 2024-04-10 15:29:48 +02:00
parent 0d085c92cf
commit 7be01d5b8f

View file

@ -89,6 +89,7 @@ import Toggle from "./Input/Toggle"
import ImportReviewIdentity from "./Reviews/ImportReviewIdentity.svelte"
import LinkedDataLoader from "../Logic/Web/LinkedDataLoader"
import SplitRoadWizard from "./Popup/SplitRoadWizard.svelte"
import DynLink from "./Base/DynLink.svelte"
class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
@ -1236,22 +1237,19 @@ export default class SpecialVisualizations {
download = undefined
}
const newTab = download === undefined && !href.startsWith("#")
return new VariableUiElement(
tagSource.map(
(tags) =>
new SvelteUIElement(Link, {
text: Utils.SubstituteKeys(text, tags),
href: Utils.SubstituteKeys(href, tags).replaceAll(
/ /g,
"%20"
) /* Chromium based browsers eat the spaces */,
classnames,
download: Utils.SubstituteKeys(download, tags),
ariaLabel: Utils.SubstituteKeys(ariaLabel, tags),
newTab
})
)
)
const textStore = tagSource.map(tags => Utils.SubstituteKeys(text, tags))
const hrefStore = tagSource.map(tags => Utils.SubstituteKeys(href, tags).replaceAll(
/ /g,
"%20"
) /* Chromium based browsers eat the spaces */)
return new SvelteUIElement(DynLink, {
text:textStore,
href: hrefStore,
classnames: new ImmutableStore(classnames),
download: tagSource.map(tags => Utils.SubstituteKeys(download, tags)),
ariaLabel: tagSource.map(tags => Utils.SubstituteKeys(ariaLabel, tags)),
newTab: new ImmutableStore(newTab)
})
}
},
{
@ -1309,6 +1307,10 @@ export default class SpecialVisualizations {
} else {
properties = <any>tags[key]
}
if(!properties){
console.debug("Could not create a special visualization for multi(",args.join(", ")+")", "no properties found for object",feature.properties.id)
return undefined
}
const elements = []
for (const property of properties) {
const subsTr = new SvelteUIElement(SpecialTranslation, {