mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 05:13:30 -07:00
WebUI: avoid double lookup
This commit is contained in:
parent
380b25e22f
commit
559f47ab0c
1 changed files with 4 additions and 4 deletions
|
@ -58,7 +58,7 @@ window.qBittorrent.FileTree ??= (() => {
|
||||||
|
|
||||||
class FileTree {
|
class FileTree {
|
||||||
#root = null;
|
#root = null;
|
||||||
#nodeMap = {};
|
#nodeMap = {}; // Object with Number as keys is faster than anything
|
||||||
|
|
||||||
setRoot(root) {
|
setRoot(root) {
|
||||||
this.#root = root;
|
this.#root = root;
|
||||||
|
@ -86,9 +86,9 @@ window.qBittorrent.FileTree ??= (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
getNode(rowId) {
|
getNode(rowId) {
|
||||||
return (this.#nodeMap[rowId] === undefined)
|
// TODO: enforce caller sites to pass `rowId` as number and not string
|
||||||
? null
|
const value = this.#nodeMap[Number(rowId)];
|
||||||
: this.#nodeMap[rowId];
|
return (value !== undefined) ? value : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRowId(node) {
|
getRowId(node) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue