Fix: attempts to stabilize

This commit is contained in:
Pieter Vander Vennet 2025-03-11 03:53:05 +01:00
parent 686ad70511
commit ae84207555
4 changed files with 31 additions and 24 deletions

View file

@ -76,7 +76,7 @@ export default class SaveFeatureSourceToLocalStorage {
const storage = TileLocalStorage.construct<Feature[]>(backend, layername, maxCacheAge)
this.storage = storage
const singleTileSavers: Map<number, SingleTileSaver> = new Map<number, SingleTileSaver>()
features.features.addCallbackAndRunD((features) => {
features.features.stabilized(5000).addCallbackAndRunD((features) => {
if (
features.some((f) => {
let totalPoints = 0
@ -116,7 +116,7 @@ export default class SaveFeatureSourceToLocalStorage {
tileSaver = new SingleTileSaver(src, featureProperties)
singleTileSavers.set(tileIndex, tileSaver)
}
// Don't cache not-uploaded features yet - they'll be cached when the receive their id
// Don't cache not-uploaded features yet - they'll be cached when they receive their id
features = features.filter((f) => !f.properties.id.match(/(node|way)\/-[0-9]+/))
tileSaver.saveFeatures(features)
})