From eccc59380b3c8a97bdda72dcf7a384a67e294918 Mon Sep 17 00:00:00 2001 From: rapid0o Date: Wed, 26 Jan 2022 16:04:48 +0100 Subject: [PATCH 1/2] fix: search request pagination calculate offset not using hitsPerPage options fallback --- src/adapters/SearchRequestAdapter.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/adapters/SearchRequestAdapter.js b/src/adapters/SearchRequestAdapter.js index d5d4ec7..f50c280 100644 --- a/src/adapters/SearchRequestAdapter.js +++ b/src/adapters/SearchRequestAdapter.js @@ -85,9 +85,10 @@ const SearchRequestAdapter = () => { */ const transformPagination = (request, options = {}) => { const { page, hitsPerPage } = request?.params ?? {}; - const offset = page * hitsPerPage; + const limit = hitsPerPage || options.hitsPerPage; + const offset = page * limit; - return { limit: hitsPerPage || options.hitsPerPage, offset }; + return { limit, offset }; }; /** From 12407742cd0cc74d4dc2b47d933fc8640e1a5040 Mon Sep 17 00:00:00 2001 From: rapid0o Date: Wed, 26 Jan 2022 16:05:47 +0100 Subject: [PATCH 2/2] chore: bump version to 1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 32793d7..bd8b714 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@afosto/instant-search-client", - "version": "1.0.0", + "version": "1.0.1", "private": false, "description": "The Afosto InstantSearch client", "main": "./dist/afosto-instant-search.min.js",