Skip to content

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

fix: do not subscribe to the same event twice

thecodrrd5c8c3cc6118
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index f72c18e1c..615c456a2 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -50,6 +50,13 @@ class UserStore extends BaseStore {
return db.user.fetchUser().then(async (user) => {
if (!user) return false;
+ EV.remove(
+ EVENTS.userSubscriptionUpdated,
+ EVENTS.userEmailConfirmed,
+ EVENTS.databaseSyncRequested,
+ EVENTS.userLoggedOut
+ );
+
this.set((state) => {
state.user = user;
state.isLoggedIn = true;
@@ -63,6 +70,7 @@ class UserStore extends BaseStore {
});
EV.subscribe(EVENTS.databaseSyncRequested, async () => {
+ console.log("Sync requested.");
await appStore.sync(false);
});