diff --git a/frontend/src/components/Controls/Link.vue b/frontend/src/components/Controls/Link.vue index d351db3c..5eef3930 100644 --- a/frontend/src/components/Controls/Link.vue +++ b/frontend/src/components/Controls/Link.vue @@ -88,17 +88,17 @@ watchDebounced( val = val || '' if (text.value === val) return text.value = val - options.update({ - params: { - txt: val, - doctype: props.doctype, - }, - }) - options.reload() + reload(val) }, { debounce: 300, immediate: true } ) +watchDebounced( + () => props.doctype, + () => reload(''), + { debounce: 300, immediate: true } +) + const options = createResource({ url: 'frappe.desk.search.search_link', cache: [props.doctype, text.value], @@ -117,6 +117,16 @@ const options = createResource({ }, }) +function reload(val) { + options.update({ + params: { + txt: val, + doctype: props.doctype, + }, + }) + options.reload() +} + const labelClasses = computed(() => { return [ {