Add initialSyncDone property to storage service

Allows us to know when the first sync cycle has been completed
This commit is contained in:
Râu Cao 2026-01-22 16:39:51 +07:00
parent b08dcedd13
commit 2a203e8e82
Signed by: raucao
GPG Key ID: 37036C356E56CC51

View File

@ -12,6 +12,7 @@ export default class StorageService extends Service {
@tracked loadedPrefixes = [];
@tracked currentBbox = null;
@tracked version = 0; // Shared version tracker for bookmarks
@tracked initialSyncDone = false;
constructor() {
super(...arguments);
@ -31,10 +32,16 @@ export default class StorageService extends Service {
// widget.attach();
this.rs.on('ready', () => {
// this.loadAllPlaces();
// console.debug('[rs] client ready');
});
this.rs.on('sync-done', result => {
// console.debug('[rs] sync done:', result);
if (!this.initialSyncDone) { this.initialSyncDone = true; }
});
this.rs.scope('/places/').on('change', (event) => {
console.debug(event);
debounce(this, this.reloadCurrentView, 200);
});
}