mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Fix/ Issue872 search breaks page filter combo (#873)
* fix filter + pagination issue on search page * fix lint issues
This commit is contained in:
parent
579b213160
commit
dfb96c0913
@ -34,29 +34,16 @@ export default function SearchPage({
|
||||
)
|
||||
const newCancelToken = useCancelToken()
|
||||
|
||||
useEffect(() => {
|
||||
async function initSearch() {
|
||||
async function fetchAssets() {
|
||||
setLoading(true)
|
||||
setTotalResults(undefined)
|
||||
const queryResult = await getResults(parsed, chainIds, newCancelToken())
|
||||
|
||||
setQueryResult(queryResult)
|
||||
setTotalResults(queryResult.totalResults)
|
||||
setTotalPagesNumber(queryResult.totalPages)
|
||||
setLoading(false)
|
||||
}
|
||||
initSearch()
|
||||
}, [
|
||||
text,
|
||||
owner,
|
||||
tags,
|
||||
sort,
|
||||
page,
|
||||
serviceType,
|
||||
accessType,
|
||||
sortOrder,
|
||||
chainIds,
|
||||
newCancelToken
|
||||
])
|
||||
|
||||
function setPage(page: number) {
|
||||
const newUrl = updateQueryStringParameter(
|
||||
@ -67,6 +54,21 @@ export default function SearchPage({
|
||||
return navigate(newUrl)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
async function initSearch() {
|
||||
await fetchAssets()
|
||||
}
|
||||
initSearch()
|
||||
}, [text, owner, tags, sort, page, sortOrder, chainIds, newCancelToken])
|
||||
|
||||
useEffect(() => {
|
||||
if (page !== '1') {
|
||||
setPage(1)
|
||||
} else {
|
||||
fetchAssets()
|
||||
}
|
||||
}, [serviceType, accessType])
|
||||
|
||||
return (
|
||||
<Permission eventType="browse">
|
||||
<>
|
||||
|
Loading…
Reference in New Issue
Block a user