Filter pagination reset; catalog model retype tool
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
placeholder="Search models..."
|
||||
@input="debouncedSearch"
|
||||
/>
|
||||
<select v-model="vendorFilter" class="form-control" @change="loadModels">
|
||||
<select v-model="vendorFilter" class="form-control" @change="applyFilter">
|
||||
<option value="">All Vendors</option>
|
||||
<option v-for="v in vendors" :key="v.vendorid" :value="v.vendorid">
|
||||
{{ v.vendor }}
|
||||
@@ -272,6 +272,19 @@ onMounted(async () => {
|
||||
])
|
||||
})
|
||||
|
||||
// A filter change must go back to page 1. Selecting a filter while on page 5
|
||||
// asked the server for page 5 of a result set that now has one page, and the
|
||||
// list came back empty as though the filter matched nothing.
|
||||
//
|
||||
// setPage(1) writes the URL, which the composable's watcher picks up and
|
||||
// answers with onChange - so calling the loader as well would fetch twice.
|
||||
// Load directly only when already on page 1, where nothing changes and the
|
||||
// watcher stays silent.
|
||||
function applyFilter() {
|
||||
if (page.value > 1) setPage(1)
|
||||
else loadModels()
|
||||
}
|
||||
|
||||
async function loadModels() {
|
||||
loading.value = true
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user