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.
This commit is contained in:
Chocobo1 2025-04-05 13:51:08 +08:00 committed by GitHub
commit cdddaae939
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
});