forked from MapComplete/MapComplete
Fix: disable crash in settings by improving typing
This commit is contained in:
parent
f1dc2c30c0
commit
edbfc5f86b
4 changed files with 19 additions and 5 deletions
|
@ -25,12 +25,20 @@ export default class SvelteUIElement<
|
|||
private tag: "div" | "span" = "div"
|
||||
public readonly isSvelte = true
|
||||
|
||||
constructor(svelteElement, props?: Props, events?: Events, slots?: Slots) {
|
||||
constructor(svelteElement : {
|
||||
new (args: {
|
||||
target: HTMLElement
|
||||
props: Props
|
||||
events?: Events
|
||||
slots?: Slots
|
||||
}): SvelteComponentTyped<Props, Events, Slots>
|
||||
}, props?: Props, events?: Events, slots?: Slots) {
|
||||
super()
|
||||
this._svelteComponent = <any>svelteElement
|
||||
this._props = props ?? <Props>{}
|
||||
this._events = events
|
||||
this._slots = slots
|
||||
console.trace("Constructing a special stack element")
|
||||
}
|
||||
|
||||
public setSpan() {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
{#if isSvelte}
|
||||
{#if svelteElem?._svelteComponent}
|
||||
{#if svelteElem.getClass() || svelteElem.getStyle()}
|
||||
<svelte:component
|
||||
this={svelteElem?._svelteComponent}
|
||||
|
|
|
@ -17,6 +17,7 @@ import { Feature } from "geojson"
|
|||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
import QrCode from "../Popup/QrCode.svelte"
|
||||
import ClearGPSHistory from "../BigComponents/ClearGPSHistory.svelte"
|
||||
import DisabledQuestions from "../Popup/DisabledQuestions.svelte"
|
||||
|
||||
class LanguagePickerVis extends SpecialVisualizationSvelte {
|
||||
funcName = "language_picker"
|
||||
|
@ -40,7 +41,7 @@ class LanguagePickerVis extends SpecialVisualizationSvelte {
|
|||
}
|
||||
}
|
||||
|
||||
class DisabledQuestions extends SpecialVisualizationSvelte {
|
||||
class DisabledQuestionsVis extends SpecialVisualizationSvelte {
|
||||
funcName = "disabled_questions"
|
||||
group = "settings"
|
||||
docs = "Shows which questions are disabled for every layer. Used in 'settings'"
|
||||
|
@ -234,7 +235,7 @@ export class SettingsVisualisations {
|
|||
return [
|
||||
new LanguagePickerVis(),
|
||||
|
||||
new DisabledQuestions(),
|
||||
new DisabledQuestionsVis(),
|
||||
new GyroscopeAllTags(),
|
||||
new GpsAllTags(),
|
||||
new StorageAlLTags(),
|
||||
|
|
|
@ -1630,7 +1630,12 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
;[_, functionName, path, line, column] = matchWithFuncName
|
||||
} else {
|
||||
const regexNoFuncName: RegExp = new RegExp("at ([a-zA-Z0-9-/.]+):([0-9]+):([0-9]+)")
|
||||
;[_, path, line, column] = stackItem.match(regexNoFuncName)
|
||||
try {
|
||||
[_, path, line, column] = stackItem.match(regexNoFuncName)
|
||||
} catch (e) {
|
||||
console.error("Could not match a stack item:", stackItem)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
const markdownLocation = path.substring(path.indexOf("MapComplete/src") + 11) + "#L" + line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue