Skip to content

Commit

Permalink
Merge pull request #12 from hoppscotch/workspace-refactor-changes
Browse files Browse the repository at this point in the history
refactor: add support for new abstractions at the workspace level
  • Loading branch information
anwarulislam authored May 23, 2024
2 parents 971ae10 + 11ebb5a commit 49c279c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hoppscotch/ui",
"version": "0.1.3",
"version": "0.1.4",
"license": "MIT",
"description": "Hoppscotch UI",
"author": "Hoppscotch ([email protected])",
Expand Down
4 changes: 2 additions & 2 deletions src/components/smart/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</template>

<script setup lang="ts" generic="T extends any">
import { computed, inject } from "vue"
import { inject } from "vue"
import SmartTreeBranch from "./TreeBranch.vue"
import SmartSpinner from "./Spinner.vue"
import { SmartTreeAdapter, TreeNode } from "~/helpers/treeAdapter"
Expand All @@ -68,5 +68,5 @@ const props = defineProps<{
/**
* Fetch the root nodes from the adapter by passing the node id as null
*/
const rootNodes = computed(() => props.adapter.getChildren(null).value)
const rootNodes = props.adapter.getChildren(null)
</script>
6 changes: 2 additions & 4 deletions src/components/smart/TreeBranch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
>
<SmartTreeBranch
v-for="childNode in childNodes.data"
:key="childNode.id"
:key="`${childNode.id}-${childNode.data.type}`"
:node-item="childNode"
:adapter="adapter"
>
Expand Down Expand Up @@ -114,9 +114,7 @@ const highlightNode = ref(false)
/**
* Fetch the child nodes from the adapter by passing the node id of the current node
*/
const childNodes = computed(
() => props.adapter.getChildren(props.nodeItem.id).value,
)
const childNodes = props.adapter.getChildren(props.nodeItem.id, props.nodeItem.data.type)
const toggleNodeChildren = () => {
if (!childrenRendered.value) childrenRendered.value = true
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/treeAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export interface SmartTreeAdapter<T> {
/**
*
* @param nodeID - id of the node to get children for
* @param nodeType - Type of the node (`collection` | `request`)
* @returns - Ref that contains the children of the node. It is reactive and will be updated when the children are changed.
*/
getChildren: (nodeID: string | null) => Ref<ChildrenResult<T>>
getChildren: (nodeID: string | null, nodeType?: string) => Ref<ChildrenResult<T>>
}

0 comments on commit 49c279c

Please sign in to comment.