forked from MapComplete/MapComplete
Studio: fix #2316
This commit is contained in:
parent
ff53354c96
commit
ceabc5573c
2 changed files with 15 additions and 14 deletions
|
@ -5,8 +5,9 @@
|
|||
/**
|
||||
* For some stupid reason, it is very hard to let {#if} work together with UIEventSources, so we wrap then here
|
||||
*/
|
||||
export let condition: Store<boolean>
|
||||
let _c = condition.data
|
||||
export let condition: Store<boolean> | undefined
|
||||
let _c = condition?.data
|
||||
if (condition !== undefined) {
|
||||
onDestroy(
|
||||
condition.addCallback((c) => {
|
||||
/* Do _not_ abbreviate this as `.addCallback(c => _c = c)`. This is the same as writing `.addCallback(c => {return _c = c})`,
|
||||
|
@ -15,6 +16,7 @@
|
|||
return false
|
||||
})
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if _c}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
import Markdown from "../../Base/Markdown.svelte"
|
||||
import { Utils } from "../../../Utils"
|
||||
import type { UploadableTag } from "../../../Logic/Tags/TagTypes"
|
||||
import { Modal } from "flowbite-svelte"
|
||||
import Popup from "../../Base/Popup.svelte"
|
||||
import If from "../../Base/If.svelte"
|
||||
import DotMenu from "../../Base/DotMenu.svelte"
|
||||
|
@ -341,7 +340,7 @@
|
|||
.catch(console.error)
|
||||
}
|
||||
|
||||
let disabledInTheme = state.userRelatedState.getThemeDisabled(state.theme.id, layer?.id)
|
||||
let disabledInTheme = state.userRelatedState?.getThemeDisabled(state.theme.id, layer?.id) ?? new UIEventSource<string[]>([])
|
||||
let menuIsOpened = new UIEventSource(false)
|
||||
|
||||
function disableQuestion() {
|
||||
|
@ -361,7 +360,7 @@
|
|||
|
||||
{#if question !== undefined && $apiState !== "readonly" && $apiState !== "offline"}
|
||||
<div class={clss}>
|
||||
{#if layer.isNormal()}
|
||||
{#if layer?.isNormal()}
|
||||
<LoginToggle {state}>
|
||||
<DotMenu hideBackground={true} open={menuIsOpened}>
|
||||
<SidebarUnit>
|
||||
|
@ -559,7 +558,7 @@
|
|||
</h2>
|
||||
<Tr t={Translations.t.unknown.explanation} />
|
||||
<If
|
||||
condition={state.userRelatedState.showTags.map(
|
||||
condition={state.userRelatedState?.showTags?.map(
|
||||
(v) => v === "yes" || v === "full" || v === "always"
|
||||
)}
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue