fix: speedup table reload by updating only changed statuses

it has been found that on big (>100) repos it starts lagging on reload.
This commit adds guard to avoid updating rows whose package statuses
were not changed
This commit is contained in:
2026-02-18 22:56:50 +02:00
parent bbf9e38fda
commit 59205b990c

View File

@@ -198,13 +198,16 @@
function updateTable(table, rows) { function updateTable(table, rows) {
// instead of using load method here, we just update rows manually to avoid table reinitialization // instead of using load method here, we just update rows manually to avoid table reinitialization
const currentData = table.bootstrapTable("getData").reduce((accumulator, row) => { const currentData = table.bootstrapTable("getData").reduce((accumulator, row) => {
accumulator[row.id] = row["0"]; accumulator[row.id] = {state: row["0"], status: row.status};
return accumulator; return accumulator;
}, {}); }, {});
// insert or update rows // insert or update rows, skipping ones whose status hasn't changed
rows.forEach(row => { rows.forEach(row => {
if (Object.hasOwn(currentData, row.id)) { if (Object.hasOwn(currentData, row.id)) {
row["0"] = currentData[row.id]; // copy checkbox state if (row.status === currentData[row.id].status) {
return;
}
row["0"] = currentData[row.id].state; // copy checkbox state
table.bootstrapTable("updateByUniqueId", { table.bootstrapTable("updateByUniqueId", {
id: row.id, id: row.id,
row: row, row: row,