Data field change event trigger

Trying to call fill_table when user enter data in this fields. In local system system fill the table based on selected inward voucher.

But after hosting in frappe cloud, system triggering the event when user selecting the voucher and when user pressing any key in the UI. 2 times the event is calling.

What may be reason to call the event 2 times.

inward_voucher:function(frm) {
if (frm.doc.inward_voucher) {
frm.trigger(“fill_table”);
}
},

let isFillingTable = false;

inward_voucher: function(frm) {
    if (frm.doc.inward_voucher && !isFillingTable) {
        isFillingTable = true;
        frm.trigger("fill_table");
        setTimeout(() => { isFillingTable = false; }, 100);
    }
}

Above code will make sure the fill_table function runs only once by waiting a short time before allowing it to run again.

After filling the data in the table, the 2nd time triggering the event when user click on another tab or press any key. we are not doing any entry in the “inward_voucher”. local its calling only one time…