diff --git a/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue b/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue index e9d56d48f..d264e2b5a 100644 --- a/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue +++ b/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue @@ -92,7 +92,8 @@ import { useNodeBookmarkStore } from '@/stores/nodeBookmarkStore' const nodeDefStore = useNodeDefStore() const nodeBookmarkStore = useNodeBookmarkStore() -const { expandedKeys, expandNode, toggleNodeOnEvent } = useTreeExpansion() +const expandedKeys = ref>({}) +const { expandNode, toggleNodeOnEvent } = useTreeExpansion(expandedKeys) const nodeBookmarkTreeExplorerRef = ref() -const { expandedKeys, expandNode, toggleNodeOnEvent } = useTreeExpansion() +const expandedKeys = ref>({}) +const { expandNode, toggleNodeOnEvent } = useTreeExpansion(expandedKeys) const handleNodeClick = ( node: RenderedTreeExplorerNode, diff --git a/src/hooks/treeHooks.ts b/src/hooks/treeHooks.ts index 421e626e6..b9b235bf6 100644 --- a/src/hooks/treeHooks.ts +++ b/src/hooks/treeHooks.ts @@ -1,9 +1,7 @@ -import { ref } from 'vue' +import { Ref } from 'vue' import type { TreeNode } from 'primevue/treenode' -export function useTreeExpansion() { - const expandedKeys = ref>({}) - +export function useTreeExpansion(expandedKeys: Ref>) { const toggleNode = (node: TreeNode) => { if (node.key && typeof node.key === 'string') { if (node.key in expandedKeys.value) { @@ -63,7 +61,6 @@ export function useTreeExpansion() { } return { - expandedKeys, toggleNode, toggleNodeRecursive, expandNode,