fix(Link): improve logic for early exit

This commit is contained in:
Sagar Vora 2025-12-01 22:48:26 +05:30
parent e3e5b6616a
commit da4c31b60c

View file

@ -6,7 +6,6 @@
// add_fetches
import Awesomplete from "awesomplete";
frappe.ui.form.recent_link_validations = {};
const SPECIAL_VALUES = ["create_new__link_option", "advanced_search__link_option"];
frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlData {
static trigger_change_on_input_event = false;
@ -674,8 +673,7 @@ frappe.ui.form.ControlLink = class ControlLink extends frappe.ui.form.ControlDat
if (
nothing_to_fetch &&
value &&
!SPECIAL_VALUES.includes(value) &&
this.awesomplete.get_item(value)
this.awesomplete._list?.find((item) => item.value === value && !item.action)
) {
// if value is in the suggestion list, must be correct
return value;