fix: ensure tree nodes are not computed for requests

This commit is contained in:
jamesgeorge007
2024-02-27 22:54:51 +05:30
parent 62612e6c51
commit a729dfcacb
2 changed files with 9 additions and 3 deletions

View File

@@ -10,7 +10,8 @@ export class WorkspaceRESTSearchCollectionTreeAdapter
constructor(public data: Ref<HoppCollection[]>) {} constructor(public data: Ref<HoppCollection[]>) {}
getChildren( getChildren(
nodeID: string | null nodeID: string | null,
nodeType?: string
): Ref<ChildrenResult<RESTCollectionViewItem>> { ): Ref<ChildrenResult<RESTCollectionViewItem>> {
const result = ref<ChildrenResult<RESTCollectionViewItem>>({ const result = ref<ChildrenResult<RESTCollectionViewItem>>({
status: "loading", status: "loading",
@@ -34,7 +35,7 @@ export class WorkspaceRESTSearchCollectionTreeAdapter
}, },
})), })),
} }
} else { } else if (nodeType === "collection") {
const indexPath = nodeID.split("/").map((x) => parseInt(x)) const indexPath = nodeID.split("/").map((x) => parseInt(x))
const item = navigateToFolderWithIndexPath(this.data.value, indexPath) const item = navigateToFolderWithIndexPath(this.data.value, indexPath)

View File

@@ -18,7 +18,8 @@ export class WorkspaceRESTCollectionTreeAdapter
) {} ) {}
public getChildren( public getChildren(
nodeID: string | null nodeID: string | null,
nodeType?: string
): Ref<ChildrenResult<RESTCollectionViewItem>> { ): Ref<ChildrenResult<RESTCollectionViewItem>> {
if (this.workspaceHandle.value.type !== "ok") { if (this.workspaceHandle.value.type !== "ok") {
throw new Error("Cannot issue children with invalid workspace handle") throw new Error("Cannot issue children with invalid workspace handle")
@@ -30,6 +31,10 @@ export class WorkspaceRESTCollectionTreeAdapter
if (nodeID !== null) { if (nodeID !== null) {
;(async () => { ;(async () => {
if (nodeType === "request") {
return
}
const collectionHandleResult = const collectionHandleResult =
await this.workspaceService.getCollectionHandle( await this.workspaceService.getCollectionHandle(
this.workspaceHandle, this.workspaceHandle,