forked from MapComplete/MapComplete
Performance: sprinkle 'onDestroy' everywhere to cleanup old stores; cleanup 'Stores' utility class
This commit is contained in:
parent
66f093afd8
commit
81be4db044
79 changed files with 332 additions and 325 deletions
|
|
@ -20,6 +20,7 @@
|
|||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
import Translations from "../../i18n/Translations"
|
||||
import Tr from "../../Base/Tr.svelte"
|
||||
import { onDestroy } from "svelte"
|
||||
|
||||
export let value: UIEventSource<number>
|
||||
export let feature: Feature
|
||||
|
|
@ -84,7 +85,7 @@
|
|||
},
|
||||
]
|
||||
},
|
||||
[mapLocation]
|
||||
[mapLocation], onDestroy
|
||||
)
|
||||
|
||||
new ShowDataLayer(map, {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
forceIndex = floors.data.indexOf(level)
|
||||
})
|
||||
|
||||
Stores.Chronic(50).addCallback(() => stabilize())
|
||||
Stores.chronic(50).addCallback(() => stabilize())
|
||||
floors.addCallback((floors) => {
|
||||
forceIndex = floors.findIndex((s) => s === value.data)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
import { GeoOperations } from "../../../Logic/GeoOperations"
|
||||
import If from "../../Base/If.svelte"
|
||||
import type { SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
import { onDestroy } from "svelte"
|
||||
|
||||
/**
|
||||
* The value exported to outside, saved only when the button is pressed
|
||||
|
|
@ -61,7 +62,7 @@
|
|||
} else {
|
||||
return -1
|
||||
}
|
||||
})
|
||||
}, onDestroy)
|
||||
|
||||
beta.map(
|
||||
(beta) => {
|
||||
|
|
@ -77,7 +78,7 @@
|
|||
previewDegrees.setData(beta + "°")
|
||||
previewPercentage.setData(degreesToPercentage(beta))
|
||||
},
|
||||
[valuesign, beta]
|
||||
[valuesign, beta], onDestroy
|
||||
)
|
||||
|
||||
function onSave() {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import Translations from "../../i18n/Translations"
|
||||
import Tr from "../../Base/Tr.svelte"
|
||||
import { ImmutableStore, Store, Stores, UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import { ImmutableStore, Store, UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import Wikidata, { WikidataResponse } from "../../../Logic/Web/Wikidata"
|
||||
import Locale from "../../i18n/Locale"
|
||||
import Loading from "../../Base/Loading.svelte"
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
})
|
||||
WikidataValidator._searchCache.set(key, promise)
|
||||
}
|
||||
return Stores.FromPromiseWithErr(promise)
|
||||
return UIEventSource.fromPromiseWithErr(promise)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@
|
|||
)
|
||||
}
|
||||
|
||||
const isValid = unvalidatedText.map((v) => validator?.isValid(v, getCountry) ?? true)
|
||||
const isValid = unvalidatedText.map((v) => validator?.isValid(v, getCountry) ?? true, onDestroy)
|
||||
|
||||
let htmlElem: HTMLInputElement | HTMLTextAreaElement
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue