diff --git a/Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource.ts b/Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource.ts index 232cd3113c..19f4511e79 100644 --- a/Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource.ts +++ b/Logic/FeatureSource/Sources/NewGeometryFromChangesFeatureSource.ts @@ -9,7 +9,10 @@ export class NewGeometryFromChangesFeatureSource implements FeatureSource { // This class name truly puts the 'Java' into 'Javascript' /** - * A feature source containing exclusively new elements + * A feature source containing exclusively new elements. + * + * These elements are probably created by the 'SimpleAddUi' which generates a new point, but the import functionality might create a line or polygon too. + * Other sources of new points are e.g. imports from nodes */ public readonly features: UIEventSource<{ feature: any; freshness: Date }[]> = new UIEventSource<{ feature: any; freshness: Date }[]>([]); public readonly name: string = "newFeatures"; diff --git a/Logic/UIEventSource.ts b/Logic/UIEventSource.ts index c2ecc0c252..522878277d 100644 --- a/Logic/UIEventSource.ts +++ b/Logic/UIEventSource.ts @@ -227,12 +227,9 @@ export abstract class Store { const newSource = new UIEventSource(this.data); - let currentCallback = 0; this.addCallback(latestData => { - currentCallback++; - const thisCallback = currentCallback; window.setTimeout(() => { - if (thisCallback === currentCallback) { + if (this.data == latestData) { // compare by reference newSource.setData(latestData); } }, millisToStabilize) diff --git a/UI/BigComponents/SimpleAddUI.ts b/UI/BigComponents/SimpleAddUI.ts index 9310928638..78fa604a0d 100644 --- a/UI/BigComponents/SimpleAddUI.ts +++ b/UI/BigComponents/SimpleAddUI.ts @@ -81,7 +81,7 @@ export default class SimpleAddUI extends Toggle { const presetsOverview = SimpleAddUI.CreateAllPresetsPanel(selectedPreset, state) - async function createNewPoint(tags: any[], location: { lat: number, lon: number }, snapOntoWay?: OsmWay) { + async function createNewPoint(tags: any[], location: { lat: number, lon: number }, snapOntoWay?: OsmWay) : Promise{ const newElementAction = new CreateNewNodeAction(tags, location.lat, location.lon, { theme: state.layoutToUse?.id ?? "unkown", changeType: "create",