fix: reload link options when doctype changes

This commit is contained in:
Shariq Ansari 2023-12-31 14:52:19 +05:30
parent 01beb61f0c
commit 50830e6138

View File

@ -88,17 +88,17 @@ watchDebounced(
val = val || '' val = val || ''
if (text.value === val) return if (text.value === val) return
text.value = val text.value = val
options.update({ reload(val)
params: {
txt: val,
doctype: props.doctype,
},
})
options.reload()
}, },
{ debounce: 300, immediate: true } { debounce: 300, immediate: true }
) )
watchDebounced(
() => props.doctype,
() => reload(''),
{ debounce: 300, immediate: true }
)
const options = createResource({ const options = createResource({
url: 'frappe.desk.search.search_link', url: 'frappe.desk.search.search_link',
cache: [props.doctype, text.value], 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(() => { const labelClasses = computed(() => {
return [ return [
{ {