From 205850a9277847e59bd31699d01516d5f1ad09f9 Mon Sep 17 00:00:00 2001 From: Jatin3128 <140256508+Jatin3128@users.noreply.github.com> Date: Fri, 21 Aug 2026 01:57:04 +0530 Subject: [PATCH] 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 275844d49654688b2323bd6b5273f13546a154a6) # Conflicts: # erpnext/accounts/doctype/journal_entry/journal_entry.js --- erpnext/accounts/doctype/journal_entry/journal_entry.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js index 3e5a3071c8f..47b6f3edde5 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.js +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js @@ -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)) }, });