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.
This commit is contained in:
Jatin3128
2026-08-21 01:57:04 +05:30
committed by GitHub
parent 624d402143
commit 275844d496

View File

@@ -677,6 +677,6 @@ Object.assign(erpnext.journal_entry, {
} else {
erpnext.journal_entry.set_debit_credit_in_company_currency(frm, cdt, cdn);
}
frm.refresh_field("accounts");
frm.get_field("accounts").grid.refresh_row(cdn);
},
});