diff --git a/src/components/tags/TagTree.tsx b/src/components/tags/TagTree.tsx index 06e299fe..01c4a886 100644 --- a/src/components/tags/TagTree.tsx +++ b/src/components/tags/TagTree.tsx @@ -60,6 +60,7 @@ export function TagTree({ onOpenTagSettings }: TagTreeProps = {}) { const setSelectedTag = useUIStore(s => s.setSelectedTag); const openSearchPalette = useUIStore(s => s.openSearchPalette); const expandedTagIds = useUIStore(s => s.expandedTagIds); + const expandTagPath = useUIStore(s => s.expandTagPath); const fetchAtoms = useAtomsStore(s => s.fetchAtoms); const fetchAtomsByTag = useAtomsStore(s => s.fetchAtomsByTag); @@ -155,7 +156,11 @@ export function TagTree({ onOpenTagSettings }: TagTreeProps = {}) { const handleCreateTag = async () => { if (newTagModal.name.trim()) { - await createTag(newTagModal.name.trim(), newTagModal.parentId || undefined); + const parentId = newTagModal.parentId; + await createTag(newTagModal.name.trim(), parentId || undefined); + if (parentId) { + expandTagPath([parentId]); + } setNewTagModal({ isOpen: false, parentId: null, name: '' }); } }; diff --git a/src/stores/ui.ts b/src/stores/ui.ts index 3ac54d1f..166bff84 100644 --- a/src/stores/ui.ts +++ b/src/stores/ui.ts @@ -519,6 +519,7 @@ export const useUIStore = create()( chatSidebarOpen: state.chatSidebarOpen, chatSidebarWidth: state.chatSidebarWidth, chatSidebarConversationId: state.chatSidebarConversationId, + expandedTagIds: state.expandedTagIds, }), // v0 → v1: 'grid' and 'list' were top-level ViewMode values. They're now // collapsed into a single 'atoms' view with a separate atomsLayout field.