From cdddaae939f57740190ec750e735fa796f3c55e4 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 5 Apr 2025 13:51:08 +0800 Subject: [PATCH] WebUI: fix preferences not applied in magnet handler Thanks for the diagnosis in this [post](https://github.com/qbittorrent/qBittorrent/issues/22495#issue-2958553624). Closes #21486. Closes #22495. PR #22504. --- src/webui/www/private/scripts/download.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/download.js b/src/webui/www/private/scripts/download.js index e175d02ea..e79d97978 100644 --- a/src/webui/www/private/scripts/download.js +++ b/src/webui/www/private/scripts/download.js @@ -131,7 +131,11 @@ window.qBittorrent.Download ??= (() => { } }; - $(window).addEventListener("load", () => { + $(window).addEventListener("load", async () => { + // user might load this page directly (via browser magnet handler) + // so wait for crucial initialization to complete + await window.parent.qBittorrent.Client.initializeCaches(); + getPreferences(); getCategories(); });