Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: run sync immediately on init

Abdullah Atta72031617eb41
diff --git a/apps/web/src/stores/app-store.ts b/apps/web/src/stores/app-store.ts
index 582a665c9..a00ca68c2 100644
--- a/apps/web/src/stores/app-store.ts
+++ b/apps/web/src/stores/app-store.ts
@@ -83,6 +83,7 @@ class AppStore extends BaseStore<AppStore> {
// this needs to happen here so reminders can be set on app load.
reminderStore.refresh();
announcementStore.refresh();
+ this.get().sync({ type: "full" });
EV.subscribe(EVENTS.appRefreshRequested, () => this.refresh());
db.eventManager.subscribe(EVENTS.syncCompleted, () => this.refresh());
@@ -128,6 +129,7 @@ class AppStore extends BaseStore<AppStore> {
// a slight delay to make sure sockets are open and can be connected
// to. Otherwise, this fails miserably.
await networkCheck.waitForInternet();
+ await this.get().sync({ type: "full" });
await db.connectSSE({ force: true }).catch(logger.error);
}
});
@@ -136,6 +138,7 @@ class AppStore extends BaseStore<AppStore> {
if (documentHidden) return;
logger.info("Page visibility changed. Reconnecting SSE...");
+ await this.get().sync({ type: "full" });
await db.connectSSE({ force: false }).catch(logger.error);
});
};