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()
|
const newCancelToken = useCancelToken()
|
||||||
|
|
||||||
useEffect(() => {
|
async function fetchAssets() {
|
||||||
async function initSearch() {
|
setLoading(true)
|
||||||
setLoading(true)
|
setTotalResults(undefined)
|
||||||
setTotalResults(undefined)
|
const queryResult = await getResults(parsed, chainIds, newCancelToken())
|
||||||
const queryResult = await getResults(parsed, chainIds, newCancelToken())
|
|
||||||
setQueryResult(queryResult)
|
setQueryResult(queryResult)
|
||||||
setTotalResults(queryResult.totalResults)
|
setTotalResults(queryResult.totalResults)
|
||||||
setTotalPagesNumber(queryResult.totalPages)
|
setTotalPagesNumber(queryResult.totalPages)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
initSearch()
|
|
||||||
}, [
|
|
||||||
text,
|
|
||||||
owner,
|
|
||||||
tags,
|
|
||||||
sort,
|
|
||||||
page,
|
|
||||||
serviceType,
|
|
||||||
accessType,
|
|
||||||
sortOrder,
|
|
||||||
chainIds,
|
|
||||||
newCancelToken
|
|
||||||
])
|
|
||||||
|
|
||||||
function setPage(page: number) {
|
function setPage(page: number) {
|
||||||
const newUrl = updateQueryStringParameter(
|
const newUrl = updateQueryStringParameter(
|
||||||
@ -67,6 +54,21 @@ export default function SearchPage({
|
|||||||
return navigate(newUrl)
|
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 (
|
return (
|
||||||
<Permission eventType="browse">
|
<Permission eventType="browse">
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user