Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix categories parent when refresh page (cache missing and not reactive)

Smaug673916272ff63d85
diff --git a/frontend/app/components/MarkdownEditor/Toolbar.vue b/frontend/app/components/MarkdownEditor/Toolbar.vue
index 0d7d3619..8ecbba1e 100644
--- a/frontend/app/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue
@@ -39,7 +39,9 @@ const emitAction = (action: string) => emit('execute-action', action);
const openModal = () => useModal().add(new Modal(shallowRef(ModalSyntax), { size: 'large' }));
-const categories = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
+const categories = computed(() =>
+ new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2),
+);
const toolbar = [
{
diff --git a/frontend/app/pages/dashboard/categories/[id]/edit.vue b/frontend/app/pages/dashboard/categories/[id]/edit.vue
index d56866aa..30a8c857 100644
--- a/frontend/app/pages/dashboard/categories/[id]/edit.vue
+++ b/frontend/app/pages/dashboard/categories/[id]/edit.vue
@@ -50,7 +50,9 @@ import DeleteModal from '../_modals/DeleteCategoryModal.vue';
const categoriesStore = useCategoriesStore();
const route = useRoute();
const category = computed(() => categoriesStore.getById(route.params.id as string));
-const categoriesItem = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
+const categoriesItem = computed(() =>
+ new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2),
+);
definePageMeta({ breadcrumb: 'Edit' });
diff --git a/frontend/app/pages/dashboard/categories/_modals/CreateCategoryModal.vue b/frontend/app/pages/dashboard/categories/_modals/CreateCategoryModal.vue
index 9559aa8a..7a2b2655 100644
--- a/frontend/app/pages/dashboard/categories/_modals/CreateCategoryModal.vue
+++ b/frontend/app/pages/dashboard/categories/_modals/CreateCategoryModal.vue
@@ -29,7 +29,9 @@
import type { Category } from '~/stores';
const categoriesStore = useCategoriesStore();
-const categoriesItem = new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2);
+const categoriesItem = computed(() =>
+ new TreeStructure(useSidebarTree().categories.value).generateTree().filter(i => i.data.type === 'category' && i.data.role == 2),
+);
const props = defineProps<{ role: number }>();
const category = ref<Partial<Category>>({