mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Only update torrents table when data changes
This commit is contained in:
parent
e25efe8b5d
commit
612aa6152a
1 changed files with 11 additions and 1 deletions
|
@ -698,6 +698,7 @@ 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();
|
||||||
|
@ -798,6 +799,9 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
if (!Object.hasOwn(response["torrents"], key))
|
if (!Object.hasOwn(response["torrents"], key))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (Object.keys(response["torrents"][key]).length === 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
response["torrents"][key]["hash"] = key;
|
response["torrents"][key]["hash"] = key;
|
||||||
response["torrents"][key]["rowId"] = key;
|
response["torrents"][key]["rowId"] = key;
|
||||||
if (response["torrents"][key]["state"])
|
if (response["torrents"][key]["state"])
|
||||||
|
@ -807,6 +811,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"]) {
|
||||||
|
@ -817,8 +822,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 (full_update || 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