sdk-react icon indicating copy to clipboard operation
sdk-react copied to clipboard

Pagination without safari component

Open AstaDK opened this issue 3 years ago • 25 comments

I using sajari for my demo app.

  1. I have 1 list and I want to show more items, I don't want to use the sajari component but I can't query after I change variables page.

  2. I using useSearchContext to get page and results, I cover my component with component search provider, code example bellow: <SearchProvider key="{index}" searchOnLoad={false} initialResponse="" search={{ pipeline: new Pipeline( { ...getConfigPipeline("") }, "query" ), variables: new Variables({ q: "", filter: "", resultsPerPage: 6, }), }} > <MyComponent/> </SearchProvider>

  3. Render result const { setQuery } = useQuery(); const { variables } = useVariables(); const { results, searching, totalResults, page, pageCount, } = useSearchContext();

  4. And then I use variables hook(useVariables) to set request for other page but It not request, code example bellow: const OtherComponent = ({ setQuery, textSearch, variables }) => { const handleShowMore = () => { variables.set({ page: page + 1, }); };

So how can set pagination without component your support?

  • [ ] I only try for used useSearch but not good for my case.

AstaDK avatar Mar 08 '21 13:03 AstaDK