diff --git a/src/Logic/FeatureSource/Sources/ChangeGeometryApplicator.ts b/src/Logic/FeatureSource/Sources/ChangeGeometryApplicator.ts index 871c865578..41ffe47d9e 100644 --- a/src/Logic/FeatureSource/Sources/ChangeGeometryApplicator.ts +++ b/src/Logic/FeatureSource/Sources/ChangeGeometryApplicator.ts @@ -2,7 +2,7 @@ * Applies geometry changes from 'Changes' onto every feature of a featureSource */ import { Changes } from "../../Osm/Changes" -import { UIEventSource } from "../../UIEventSource" +import { Stores, UIEventSource } from "../../UIEventSource" import { FeatureSource, IndexedFeatureSource } from "../FeatureSource" import { ChangeDescription, ChangeDescriptionTools } from "../../Osm/Actions/ChangeDescription" import { Feature } from "geojson" @@ -19,10 +19,9 @@ export default class ChangeGeometryApplicator implements FeatureSource { this.features = new UIEventSource(undefined) - const self = this - source.features.addCallbackAndRunD((_) => self.update()) + source.features.addCallbackAndRunD(() => this.update()) - changes.allChanges.addCallbackAndRunD((_) => self.update()) + Stores.ListStabilized(changes.allChanges).addCallbackAndRunD(() => this.update()) } private update() { @@ -65,7 +64,7 @@ export default class ChangeGeometryApplicator implements FeatureSource { // Allright! We have a feature to rewrite! const copy = { - ...feature, + ...feature } // We only apply the last change as that one'll have the latest geometry const change = changesForFeature[changesForFeature.length - 1]