forked from MapComplete/MapComplete
Fix: destroy the old core if needed
This commit is contained in:
parent
9de9f55327
commit
44b094e84b
1 changed files with 6 additions and 0 deletions
|
@ -50,6 +50,7 @@ export default class ThemeSource implements IndexedFeatureSource {
|
|||
const features = (this.features = new UIEventSource<Feature[]>([]))
|
||||
const featuresById = (this.featuresById = new UIEventSource(new Map()))
|
||||
this.core = mvtAvailableLayers.mapD((mvtAvailableLayers) => {
|
||||
this.core?.data?.destruct()
|
||||
const core = new ThemeSourceCore(
|
||||
layers,
|
||||
featureSwitches,
|
||||
|
@ -300,4 +301,9 @@ class ThemeSourceCore extends FeatureSourceMerger {
|
|||
// await Promise.all(this.supportsForceDownload.map((i) => i.updateAsync()))
|
||||
console.log("Done")
|
||||
}
|
||||
|
||||
public destruct() {
|
||||
this.features.destroy()
|
||||
this.featuresById.destroy()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue