Skip to content

Commit

Permalink
chore(ui): cleanup old optimization code (#5951)
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin authored Jun 23, 2024
1 parent a0c1d37 commit e390cb9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
1 change: 0 additions & 1 deletion packages/ui/client/composables/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ function clearResults(useFiles: File[]) {
delete f.result
getTasks(f).forEach((i) => {
delete i.result
// explorerTree.removeTaskDone(i.id)
if (map.has(i.id)) {
const task = map.get(i.id)
if (task) {
Expand Down
17 changes: 0 additions & 17 deletions packages/ui/client/composables/explorer/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class ExplorerTree {
private resumeEndRunId: ReturnType<typeof setTimeout> | undefined
constructor(
private onTaskUpdateCalled: boolean = false,
private done = new Set<string>(),
private resumeEndTimeout = 500,
public root = <RootTreeNode>{
id: 'vitest-root-node',
Expand Down Expand Up @@ -54,22 +53,6 @@ export class ExplorerTree {
this.rafCollector = useRafFn(this.runCollect.bind(this), { fpsLimit: 10, immediate: false })
}

isUITaskDone(node: UITaskTreeNode) {
return this.done.has(node.id)
}

taskDone(id: string) {
this.done.add(id)
}

removeTaskDone(id: string) {
this.done.delete(id)
}

clearDone() {
this.done.clear()
}

loadFiles(remoteFiles: File[]) {
runLoadFiles(
remoteFiles,
Expand Down
23 changes: 2 additions & 21 deletions packages/ui/client/composables/explorer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export function createOrUpdateFileNode(
let fileNode = explorerTree.nodes.get(file.id) as FileTreeNode | undefined

if (fileNode) {
// if (explorerTree.isUITaskDone(fileNode)) {
// return
// }

fileNode.state = file.result?.state
fileNode.mode = file.mode
fileNode.duration = file.result?.duration
Expand Down Expand Up @@ -83,18 +79,14 @@ export function createOrUpdateFileNode(
createOrUpdateNode(file.id, file.tasks[i], true)
}
}

// if (isTaskDone(file)) {
// explorerTree.taskDone(fileNode.id)
// }
}

export function createOrUpdateSuiteTask(
id: string,
all: boolean,
) {
const node = explorerTree.nodes.get(id)
if (!node || !isParentNode(node)/* || explorerTree.isUITaskDone(node) */) {
if (!node || !isParentNode(node)) {
return
}

Expand All @@ -107,16 +99,12 @@ export function createOrUpdateSuiteTask(
// update the node
createOrUpdateNode(node.parentId, task, all && task.tasks.length > 0)

// if (isTaskDone(task)) {
// explorerTree.taskDone(task.id)
// }

return [node, task] as const
}

export function createOrUpdateNodeTask(id: string) {
const node = explorerTree.nodes.get(id)
if (!node/* || explorerTree.isUITaskDone(node) */) {
if (!node) {
return
}

Expand All @@ -143,9 +131,6 @@ export function createOrUpdateNode(
node.tasks.push(taskNode)
node.children.add(task.id)
}
/* if (explorerTree.isUITaskDone(taskNode)) {
return
} */

taskNode.mode = task.mode
taskNode.duration = task.result?.duration
Expand Down Expand Up @@ -197,9 +182,5 @@ export function createOrUpdateNode(
createOrUpdateNode(taskNode.id, task.tasks[i], createAll)
}
}

/* if (isTaskDone(task)) {
explorerTree.taskDone(task.id)
} */
}
}

0 comments on commit e390cb9

Please sign in to comment.