Fix marketplace pagination not allowing partial pages (#22034)

This commit is contained in:
daedalus
2024-04-01 03:50:35 -04:00
committed by GitHub
parent 6e435c6300
commit aa6ba15a15
2 changed files with 14 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
'@directus/app': patch
---
Fixed marketplace pagination not allowing partial pages and corrected TS type errors for search and type query parameters.

View File

@@ -19,8 +19,14 @@ const page = useRouteQuery('page', 1, {
transform: (value) => Number(Array.isArray(value) ? value[0] : value) || 1,
});
const search = useRouteQuery('search');
const type = useRouteQuery('type');
const search = useRouteQuery<string | null>('search', null, {
transform: (value) => (Array.isArray(value) ? value[0] : value),
});
const type = useRouteQuery<string | null>('type', null, {
transform: (value) => (Array.isArray(value) ? value[0] : value),
});
const sort = useRouteQuery<'popular' | 'recent' | 'downloads'>('sort', 'popular');
watch([search, sort, type], (newVal, oldVal) => {
@@ -32,7 +38,7 @@ watch([search, sort, type], (newVal, oldVal) => {
const filterCount = ref(0);
const extensions = ref<RegistryListResponse['data'] | null>(null);
const pageCount = computed(() => Math.round(filterCount.value / perPage));
const pageCount = computed(() => Math.ceil(filterCount.value / perPage));
const loading = ref(false);
const error = ref<unknown>(null);