* Remove an entry from the tree * @param {string} url
(url)
| 411 | * @param {string} url |
| 412 | */ |
| 413 | removeEntry(url) { |
| 414 | // Update data first |
| 415 | const index = this.entries.findIndex((e) => e.url === url); |
| 416 | if (index === -1) return; |
| 417 | |
| 418 | // Clean up child tree if folder |
| 419 | const entry = this.entries[index]; |
| 420 | if (entry.isDirectory && this.childTrees.has(url)) { |
| 421 | this.childTrees.get(url).destroy(); |
| 422 | this.childTrees.delete(url); |
| 423 | } |
| 424 | |
| 425 | // Remove from entries |
| 426 | this.entries.splice(index, 1); |
| 427 | |
| 428 | // Update rendering based on mode |
| 429 | if (this.virtualList) { |
| 430 | // Virtual list mode: update items |
| 431 | this.virtualList.setItems(this.entries); |
| 432 | } else { |
| 433 | // Fragment mode: remove element directly |
| 434 | const $el = this.findElement(url); |
| 435 | if ($el) { |
| 436 | if ($el.dataset.type === "dir") { |
| 437 | $el.closest(".list.collapsible")?.remove(); |
| 438 | } else { |
| 439 | $el.remove(); |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | } |
no test coverage detected