fix: prevent infinite spinner state while expanding tree nodes
This commit is contained in:
@@ -10,8 +10,7 @@ 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",
|
||||||
@@ -35,7 +34,7 @@ export class WorkspaceRESTSearchCollectionTreeAdapter
|
|||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
} else if (nodeType === "collection") {
|
} else {
|
||||||
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)
|
||||||
@@ -62,7 +61,6 @@ export class WorkspaceRESTSearchCollectionTreeAdapter
|
|||||||
)
|
)
|
||||||
|
|
||||||
const requests = item.requests.map((request, requestID) => {
|
const requests = item.requests.map((request, requestID) => {
|
||||||
// TODO: Replace `parentCollectionID` with `collectionID`
|
|
||||||
return {
|
return {
|
||||||
id: `${nodeID}/${requestID}`,
|
id: `${nodeID}/${requestID}`,
|
||||||
data: <RESTCollectionViewItem>{
|
data: <RESTCollectionViewItem>{
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ export class WorkspaceRESTCollectionTreeAdapter
|
|||||||
if (nodeID !== null) {
|
if (nodeID !== null) {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
if (nodeType === "request") {
|
if (nodeType === "request") {
|
||||||
|
result.value = {
|
||||||
|
status: "loaded",
|
||||||
|
data: [],
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user