Skip to content

Commit

Permalink
fix: ensure tree nodes are not computed for requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Feb 27, 2024
1 parent b0c12f9 commit 845db07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -10,7 +10,8 @@ export class WorkspaceRESTSearchCollectionTreeAdapter
constructor(public data: Ref<HoppCollection[]>) {}

getChildren(
nodeID: string | null
nodeID: string | null,
nodeType?: string
): Ref<ChildrenResult<RESTCollectionViewItem>> {
const result = ref<ChildrenResult<RESTCollectionViewItem>>({
status: "loading",
Expand All @@ -34,7 +35,7 @@ export class WorkspaceRESTSearchCollectionTreeAdapter
},
})),
}
} else {
} else if (nodeType === "collection") {
const indexPath = nodeID.split("/").map((x) => parseInt(x))

const item = navigateToFolderWithIndexPath(this.data.value, indexPath)
Expand Down
Expand Up @@ -18,7 +18,8 @@ export class WorkspaceRESTCollectionTreeAdapter
) {}

public getChildren(
nodeID: string | null
nodeID: string | null,
nodeType?: string
): Ref<ChildrenResult<RESTCollectionViewItem>> {
if (this.workspaceHandle.value.type !== "ok") {
throw new Error("Cannot issue children with invalid workspace handle")
Expand All @@ -30,6 +31,10 @@ export class WorkspaceRESTCollectionTreeAdapter

if (nodeID !== null) {
;(async () => {
if (nodeType === "request") {
return
}

const collectionHandleResult =
await this.workspaceService.getCollectionHandle(
this.workspaceHandle,
Expand Down

0 comments on commit 845db07

Please sign in to comment.