From 2c4170baccf844f8061fcb0abc48252d226d3ae6 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 7 Mar 2024 13:05:49 +0500 Subject: [PATCH] web: reenable tags refreshing in editor --- apps/web/src/stores/editor-store.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 { }; 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 () => {