Filter pagination reset; catalog model retype tool

This commit is contained in:
2026-08-05 11:26:40 -04:00
parent 5ff063b881
commit 9c530a70db
10 changed files with 805 additions and 458 deletions

View File

@@ -19,11 +19,11 @@
@input="debouncedSearch"
/>
<label class="lowstock-filter">
<input v-model="lowstockOnly" type="checkbox" @change="loadItems" />
<input v-model="lowstockOnly" type="checkbox" @change="applyFilter" />
Low stock only
</label>
<label class="lowstock-filter">
<input v-model="includeRetired" type="checkbox" @change="loadItems" />
<input v-model="includeRetired" type="checkbox" @change="applyFilter" />
Include retired
</label>
</div>
@@ -108,6 +108,19 @@ let searchTimeout = null
onMounted(loadItems)
// 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 loadItems()
}
async function loadItems() {
loading.value = true
try {