Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert the commit ccfbac80a8694b8e674c4657d51e3478ff2605bd #2609

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export default function SearchWrapper({
const router = useRouter()
const {
state: { term, sort, selectedFacets },
pages,
resetInfiniteScroll,
} = useSearch()

const { data: pageProductGalleryData, isValidating } = useProductGalleryQuery(
Expand All @@ -64,16 +62,6 @@ export default function SearchWrapper({
return <EmptySearch />
}

const totalPages = Math.ceil(
pageProductGalleryData.search.products.pageInfo.totalCount / itemsPerPage
)
const stateTotalPages = pages.length

// if the total pages is less than the current state total pages, reset the infinite scroll
if (totalPages > 0 && totalPages < stateTotalPages) {
resetInfiniteScroll(0)
}

return (
<SearchPage
page={searchContentType}
Expand Down
Loading