mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-21 16:55:46 +03:00
WebUI: Eliminate unnecessary torrents table updates
Only update the torrents table when torrents are added, edited, or removed. PR #21656.
This commit is contained in:
parent
72cbc83569
commit
8991d994c2
1 changed files with 9 additions and 1 deletions
|
@ -752,12 +752,14 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
let update_categories = false;
|
let update_categories = false;
|
||||||
let updateTags = false;
|
let updateTags = false;
|
||||||
let updateTrackers = false;
|
let updateTrackers = false;
|
||||||
|
let updateTorrents = false;
|
||||||
const full_update = (response["full_update"] === true);
|
const full_update = (response["full_update"] === true);
|
||||||
if (full_update) {
|
if (full_update) {
|
||||||
torrentsTableSelectedRows = torrentsTable.selectedRowsIds();
|
torrentsTableSelectedRows = torrentsTable.selectedRowsIds();
|
||||||
update_categories = true;
|
update_categories = true;
|
||||||
updateTags = true;
|
updateTags = true;
|
||||||
updateTrackers = true;
|
updateTrackers = true;
|
||||||
|
updateTorrents = true;
|
||||||
torrentsTable.clear();
|
torrentsTable.clear();
|
||||||
category_list.clear();
|
category_list.clear();
|
||||||
tagList.clear();
|
tagList.clear();
|
||||||
|
@ -864,6 +866,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
update_categories = true;
|
update_categories = true;
|
||||||
if (addTorrentToTagList(response["torrents"][key]))
|
if (addTorrentToTagList(response["torrents"][key]))
|
||||||
updateTags = true;
|
updateTags = true;
|
||||||
|
updateTorrents = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (response["torrents_removed"]) {
|
if (response["torrents_removed"]) {
|
||||||
|
@ -874,8 +877,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
removeTorrentFromTagList(hash);
|
removeTorrentFromTagList(hash);
|
||||||
updateTags = true; // Always to update All tag
|
updateTags = true; // Always to update All tag
|
||||||
});
|
});
|
||||||
|
updateTorrents = true;
|
||||||
}
|
}
|
||||||
torrentsTable.updateTable(full_update);
|
|
||||||
|
// don't update the table unnecessarily
|
||||||
|
if (updateTorrents)
|
||||||
|
torrentsTable.updateTable(full_update);
|
||||||
|
|
||||||
if (response["server_state"]) {
|
if (response["server_state"]) {
|
||||||
const tmp = response["server_state"];
|
const tmp = response["server_state"];
|
||||||
for (const k in tmp) {
|
for (const k in tmp) {
|
||||||
|
|
Loading…
Reference in a new issue