Merge pull request #1223 from pietervdvn/fix/1219

Fix/1219
This commit is contained in:
Pieter Vander Vennet 2023-01-05 01:12:31 +01:00 committed by GitHub
commit a2a4071022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 276 additions and 134 deletions

View file

@ -45,20 +45,6 @@ export default class SelectedFeatureHandler {
const self = this
hash.addCallback(() => self.setSelectedElementFromHash())
state.featurePipeline?.newDataLoadedSignal?.addCallbackAndRunD((_) => {
// New data was loaded. In initial startup, the hash might be set (via the URL) but might not be selected yet
if (hash.data === undefined || SelectedFeatureHandler._no_trigger_on.has(hash.data)) {
// This is an invalid hash anyway
return
}
if (state.selectedElement.data !== undefined) {
// We already have something selected
return
}
self.setSelectedElementFromHash()
})
this.initialLoad()
}

View file

@ -62,7 +62,7 @@ export class OsmConnection {
private readonly _singlePage: boolean
private isChecking = false
constructor(options: {
constructor(options?: {
dryRun?: UIEventSource<boolean>
fakeUser?: false | boolean
oauth_token?: UIEventSource<string>
@ -71,6 +71,7 @@ export class OsmConnection {
osmConfiguration?: "osm" | "osm-test"
attemptLogin?: true | boolean
}) {
options = options ?? {}
this.fakeUser = options.fakeUser ?? false
this._singlePage = options.singlePage ?? true
this._oauth_config =

View file

@ -230,10 +230,12 @@ export abstract class Store<T> {
const newSource = new UIEventSource<T>(this.data)
const self = this
this.addCallback((latestData) => {
window.setTimeout(() => {
if (this.data == latestData) {
// compare by reference
if (self.data == latestData) {
// compare by reference.
// Note that 'latestData' and 'self.data' are both from the same UIEVentSource, but both are dereferenced at a different time
newSource.setData(latestData)
}
}, millisToStabilize)