If the filter has changed, re-fetch (#12625)

* If the filter has changed, re-fetch

* lint

* Clear value when filter changes
This commit is contained in:
melohagan 2024-01-22 11:29:34 +00:00 committed by GitHub
parent 36c03ad2a7
commit 165eb206d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -108,8 +108,16 @@
}
}
$: forceFetchRows(filter)
$: debouncedFetchRows(searchTerm, primaryDisplay, defaultValue)
const forceFetchRows = async () => {
// if the filter has changed, then we need to reset the options, clear the selection, and re-fetch
optionsObj = {}
fieldApi.setValue([])
selectedValue = []
debouncedFetchRows(searchTerm, primaryDisplay, defaultValue)
}
const fetchRows = async (searchTerm, primaryDisplay, defaultVal) => {
const allRowsFetched =
$fetch.loaded &&