From 3b6aab77ecbe0824eef53375d513db5a7301bfcc Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Tue, 14 Jul 2026 15:49:46 +0530 Subject: [PATCH] FIX_POLICY_TRANSACTION_AUTO_RELOAD_ISSUE --- app/Views/policy_transaction_endorsement_list.php | 14 +++++++++++--- app/Views/policy_transaction_inception_list.php | 12 ++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/Views/policy_transaction_endorsement_list.php b/app/Views/policy_transaction_endorsement_list.php index 5dc37652..4a7a2f79 100644 --- a/app/Views/policy_transaction_endorsement_list.php +++ b/app/Views/policy_transaction_endorsement_list.php @@ -359,14 +359,21 @@ var endorsementListDataTableUrl = ''; var endorsementClearCacheUrl = ''; var endorsementAutoReloadTimer = null; + var endorsementTable = null; function scheduleEndorsementAutoReload(ms) { if (endorsementAutoReloadTimer) { clearTimeout(endorsementAutoReloadTimer); } if (ms > 0) { + console.log('Endorsement auto-reload scheduled in', ms, 'ms (~', Math.round(ms / 1000), 's)'); endorsementAutoReloadTimer = setTimeout(function() { - window.location.reload(); + console.log('Endorsement auto-reload fired — refreshing table only'); + if (endorsementTable) { + endorsementTable.ajax.reload(null, false); + } else { + console.warn('endorsementTable not ready'); + } }, ms); } } @@ -421,7 +428,7 @@ if (ticketsTable.length) { nhanceListDataTableBeforeInit(); - var table = ticketsTable.DataTable(nhanceMergeListDataTableOptions({ + endorsementTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({ autoWidth: false, processing: true, serverSide: true, @@ -441,6 +448,7 @@ return $.extend({}, d, endorsementTableFilters); }, dataSrc: function(json) { + console.log('cache_expires_in_ms:', json.cache_expires_in_ms); scheduleEndorsementAutoReload(json.cache_expires_in_ms || 300000); return json.data; } @@ -524,7 +532,7 @@ ordering: false, })); nhanceListDataTableAfterInit(); - nhanceListDataTableBindAdjust(table); + nhanceListDataTableBindAdjust(endorsementTable); } else { console.error("Table not found."); } diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index a86effe9..add7a740 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -641,14 +641,21 @@ var inceptionTableFilters = ; var inceptionListDataTableUrl = ''; var inceptionClearCacheUrl = ''; var inceptionAutoReloadTimer = null; +var inceptionTable = null; function scheduleInceptionAutoReload(ms) { if (inceptionAutoReloadTimer) { clearTimeout(inceptionAutoReloadTimer); } if (ms > 0) { + console.log('Inception auto-reload scheduled in', ms, 'ms (~', Math.round(ms / 1000), 's)'); inceptionAutoReloadTimer = setTimeout(function() { - window.location.reload(); + console.log('Inception auto-reload fired — refreshing table only'); + if (inceptionTable) { + inceptionTable.ajax.reload(null, false); + } else { + console.warn('inceptionTable not ready'); + } }, ms); } } @@ -717,7 +724,7 @@ $(document).ready(function() { if (ticketsTable.length) { nhanceListDataTableBeforeInit(); - var inceptionTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({ + inceptionTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({ autoWidth: false, processing: true, serverSide: true, @@ -737,6 +744,7 @@ $(document).ready(function() { return $.extend({}, d, inceptionTableFilters); }, dataSrc: function(json) { + console.log('cache_expires_in_ms:', json.cache_expires_in_ms); scheduleInceptionAutoReload(json.cache_expires_in_ms || 300000); return json.data; }