The issue involves a complex interaction between datepicker and FieldGroup, requiring careful handling of event triggers.
The issue describes an infinite recursion caused by the interaction between datepicker and FieldGroup when setting date fields programmatically. The fix requires modifying the event handling logic to prevent the loop. The maintainer has requested additional evidence, indicating uncertainty about the issue's prevalence.
Frappe Version: (put your frappe version here, e.g. v16 develop )
{
"frappe": "17.x.x-develop (f86fe79)",
"erpnext": "17.x.x-develop (260fc6a)",
"payments": "0.0.1",
"hrms": "17.0.0-dev",
"lending": "0.0.1",
"cold_storage": "0.0.1"
}
When a Date field's value is set programmatically (such as a Dashboard Filter Dialog loading previously saved custom dates), datepicker.selectDate() is called inside date.js.
However, datepicker.selectDate() subsequently calls the datepicker's onSelect callback, which triggers a DOM input change event: this.$input.trigger("change");.
Because the inputs are tracked by frappe.ui.FieldGroup, this change event causes the FieldGroup to instantly re-evaluate its dependencies and values, which eventually calls set_value and datepicker.selectDate() again. This creates an endless programmatic loop that instantly crashes/freezes the browser tab.
The [date.js](cci:7://file:///home/frappe/frappe-bench/apps/frappe/frappe/public/js/frappe/form/controls/date.
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!