Skip to content

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

web: reenable tags refreshing in editor

Abdullah Atta2c4170baccf8
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index afdd86700..b4bdf8ada 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -211,16 +211,16 @@ class EditorStore extends BaseStore<EditorStore> {
};
refreshTags = async () => {
- // const { session } = this.get();
- // if (!session.id) return;
- // this.set({
- // tags: await db.relations
- // .to({ id: session.id, type: "note" }, "tag")
- // .selector.items(undefined, {
- // sortBy: "dateCreated",
- // sortDirection: "asc"
- // })
- // });
+ const { updateSession, getActiveSession } = this.get();
+ const session = getActiveSession();
+ if (!session || !("note" in session)) return;
+ const tags = await db.relations
+ .to({ id: session.note.id, type: "note" }, "tag")
+ .selector.items(undefined, {
+ sortBy: "dateCreated",
+ sortDirection: "asc"
+ });
+ updateSession(session.id, ["readonly", "default"], { tags });
};
refresh = async () => {