diff --git a/lxl-web/src/lib/components/Search.svelte b/lxl-web/src/lib/components/Search.svelte index 38625cbd5..8d4ebf161 100644 --- a/lxl-web/src/lib/components/Search.svelte +++ b/lxl-web/src/lib/components/Search.svelte @@ -42,6 +42,18 @@ q = q.trim(); } } + + function handlePaginationQuery(searchParams: URLSearchParams, prevData: unknown) { + const paginatedSearchParams = new URLSearchParams(Array.from(searchParams.entries())); + const limit = parseInt(searchParams.get('_limit')!, 10); + const offset = limit + parseInt(searchParams.get('_offset') || '0', 10); + + if (prevData && offset < prevData.totalItems) { + paginatedSearchParams.set('_offset', offset.toString()); + return paginatedSearchParams; + } + return undefined; + }