Skip to content

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

feat: refresh editor content on sync

thecodrr6063fe0fbab3
diff --git a/apps/web/src/stores/app-store.js b/apps/web/src/stores/app-store.js
index 74c8ca9a4..d7042918a 100644
--- a/apps/web/src/stores/app-store.js
+++ b/apps/web/src/stores/app-store.js
@@ -30,6 +30,7 @@ class AppStore extends BaseStore {
notebookStore.refresh();
trashStore.refresh();
tagStore.refresh();
+ await editorStore.refresh();
this.refreshColors();
this.refreshMenuPins();
};
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 7644b2245..eeb9da58c 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -42,6 +42,11 @@ class EditorStore extends BaseStore {
EV.subscribe(EVENTS.userLoggedOut, () => this.get().newSession());
};
+ refresh = async () => {
+ const { id } = this.get().session;
+ await this.openSession(id, true);
+ };
+
openLockedSession = async (note) => {
this.set((state) => {
state.session = {
@@ -57,12 +62,12 @@ class EditorStore extends BaseStore {
hashNavigate(`/notes/${note.id}/edit`, { replace: true });
};
- openSession = async (noteId) => {
+ openSession = async (noteId, force) => {
await db.notes.init();
const session = this.get().session;
- if (session.id === noteId) return;
+ if (session.id === noteId && !force) return;
if (session.state === SESSION_STATES.unlocked) {
this.set((state) => {