From 818a527ea1f29b6de0ffa931347d678407695636 Mon Sep 17 00:00:00 2001 From: tehcneko Date: Wed, 23 Apr 2025 01:45:48 +0100 Subject: [PATCH] WebUI: Do not try to set rowHeight to 0 --- src/webui/www/private/scripts/dynamicTable.js | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 4f49cc610..291c1ac70 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -950,17 +950,22 @@ window.qBittorrent.DynamicTable ??= (() => { this.updateRow(row, true); // refresh row height based on first row - setTimeout(() => { - if (this.tableBody.firstChild === null) - return; - const tr = this.tableBody.firstChild; - if (this.rowHeight !== tr.offsetHeight) { - this.rowHeight = tr.offsetHeight; - // rerender on row height change - this.rerender(); - } - - }); + const tr = this.tableBody.firstChild; + if (tr !== null) { + const updateRowHeight = () => { + if (tr.offsetHeight === 0) + return; + if (this.rowHeight !== tr.offsetHeight) { + this.rowHeight = tr.offsetHeight; + // rerender on row height change + this.rerender(); + } + }; + if (tr.offsetHeight === 0) + setTimeout(updateRowHeight); + else + updateRowHeight(); + } }, createRowElement: function(row, top = -1) {