fix(journal-entry): avoid full grid re-render per row in set_exchange_rate (#58328)

refresh() loops over every row in the accounts child table and calls
set_exchange_rate() for each one. That function unconditionally ended
with frm.refresh_field("accounts"), rebuilding the whole grid (header,
pagination, current page) on every single row. For large child tables
this makes opening the form scale badly with row count.

Use grid.refresh_row(cdn) instead, which only re-renders the row that
actually changed and is a no-op for rows outside the current page.

Measured on a 1000-row Journal Entry: ~8.5s to first rendered row and
~7.9s of blocked main thread before this fix, ~2.3s and ~1.9s after.

(cherry picked from commit 275844d496)

# Conflicts:
#	erpnext/accounts/doctype/journal_entry/journal_entry.js
This commit is contained in:
Jatin3128
2026-08-21 01:57:04 +05:30
committed by Mergify
parent 647c93321b
commit 205850a927

View File

@@ -774,6 +774,7 @@ $.extend(erpnext.journal_entry, {
} else {
erpnext.journal_entry.clear_fields(frm, dt, dn);
}
<<<<<<< HEAD
},
set_amount_on_last_row: function (frm, dt, dn) {
let row = locals[dt][dn];
@@ -805,5 +806,8 @@ $.extend(erpnext.journal_entry, {
row.bank_account = null;
frm.refresh_field("accounts");
=======
frm.get_field("accounts").grid.refresh_row(cdn);
>>>>>>> 275844d496 (fix(journal-entry): avoid full grid re-render per row in set_exchange_rate (#58328))
},
});