Skip to content

Commit

Permalink
fix: add check so page can never be 0 (#863)
Browse files Browse the repository at this point in the history
* fix: add check so page can never be 0

* fix: add check so page can never be 0

Co-authored-by: Beatrice Parfait <[email protected]>
  • Loading branch information
beatrice94 and Beatrice Parfait authored Dec 1, 2022
1 parent 78aef7b commit b21ad03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dirty-bobcats-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sajari/react-hooks': patch
---

Add check to ensure page is never 0
2 changes: 1 addition & 1 deletion packages/hooks/src/ContextProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const ContextProvider: React.FC<SearchProviderValues> = ({
const { pipeline, variables } = search as Required<ProviderPipelineConfig>;
const { config } = searchState;

variables.set({ [config.pageParam]: String(page) });
variables.set({ [config.pageParam]: String(Math.max(page, 1)) });
setSearching(true);
pipeline.search(variables.get());
},
Expand Down

0 comments on commit b21ad03

Please sign in to comment.