Skip to content

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

web: fix crash on sync

Abdullah Attae05e52f87015
diff --git a/apps/web/src/stores/app-store.ts b/apps/web/src/stores/app-store.ts
index 13b97fdec..529cc8a79 100644
--- a/apps/web/src/stores/app-store.ts
+++ b/apps/web/src/stores/app-store.ts
@@ -214,8 +214,8 @@ class AppStore extends BaseStore<AppStore> {
this.set((state) => {
for (const notice of notices) {
const oldIndex = state.notices.findIndex((a) => a.type === notice.type);
- if (oldIndex > -1) state.notices.splice(oldIndex, 1);
- state.notices.push(notice);
+ if (oldIndex > -1) state.notices[oldIndex] = notice;
+ else state.notices.push(notice);
}
});
};