Adding check to not re-fetch default value.

This commit is contained in:
mike12345567 2023-10-13 11:44:15 +01:00
parent d44ad549ef
commit ccfc98120d
1 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,7 @@
let tableDefinition
let searchTerm
let open
let hasFetchedDefaultValue
$: type =
datasourceType === "table" ? FieldTypes.LINK : FieldTypes.BB_REFERENCE
@ -116,7 +117,7 @@
if (allRowsFetched || !primaryDisplay) {
return
}
if (defaultVal) {
if (defaultVal && !hasFetchedDefaultValue) {
await fetch.update({
query: { equal: { _id: defaultVal } },
})
@ -124,6 +125,7 @@
if (defaultRow) {
optionsObj[defaultRow._id] = defaultRow
}
hasFetchedDefaultValue = true
}
await fetch.update({
query: { string: { [primaryDisplay]: searchTerm } },