forked from MapComplete/MapComplete
Fix: destroy the old core if needed
This commit is contained in:
parent
cdb050261e
commit
1406fd5f25
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 features = (this.features = new UIEventSource<Feature[]>([]))
|
||||||
const featuresById = (this.featuresById = new UIEventSource(new Map()))
|
const featuresById = (this.featuresById = new UIEventSource(new Map()))
|
||||||
this.core = mvtAvailableLayers.mapD((mvtAvailableLayers) => {
|
this.core = mvtAvailableLayers.mapD((mvtAvailableLayers) => {
|
||||||
|
this.core?.data?.destruct()
|
||||||
const core = new ThemeSourceCore(
|
const core = new ThemeSourceCore(
|
||||||
layers,
|
layers,
|
||||||
featureSwitches,
|
featureSwitches,
|
||||||
|
@ -300,4 +301,9 @@ class ThemeSourceCore extends FeatureSourceMerger {
|
||||||
// await Promise.all(this.supportsForceDownload.map((i) => i.updateAsync()))
|
// await Promise.all(this.supportsForceDownload.map((i) => i.updateAsync()))
|
||||||
console.log("Done")
|
console.log("Done")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public destruct() {
|
||||||
|
this.features.destroy()
|
||||||
|
this.featuresById.destroy()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue