Skip to content

Commit

Permalink
fix(producerSearch): fix search producer name
Browse files Browse the repository at this point in the history
  • Loading branch information
Torresmorah committed Aug 23, 2022
1 parent 92ca35a commit 548d74b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions webapp/src/hooks/customHooks/useBlockProducerState.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ const useBlockProducerState = () => {
useEffect(() => {
if (eosConfig.networkName === 'lacchain') return

let filter = CHIPS_FILTERS[CHIPS_NAMES.indexOf(filters.name)]
const {where,...filter} = CHIPS_FILTERS[CHIPS_NAMES.indexOf(filters.name)]

setPagination((prev) => ({
...prev,
page: 1,
...filter
...filter,
where: {...where,owner:prev.where?.owner}
}))
}, [filters, setPagination])

Expand Down
5 changes: 2 additions & 3 deletions webapp/src/hooks/customHooks/useSearchState.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ const useSearchState = ({ query }) => {
const [loadProducers, { loading = true, data: { producers, info } = {} }] =
useLazyQuery(query)
const location = useLocation()
const [pagination, setPagination] = useState({ page: 1, pages: 1, limit: 28 })
const [pagination, setPagination] = useState({ page: 1, pages: 1, limit: 28, where: null })
const [filters, setFilters] = useState({ name: 'all', owner: '' })

const handleOnSearch = (newFilters) => {
if(newFilters.owner){
setPagination((prev) => ({
...prev,
page: 1,
where: { owner: { _like: `%${newFilters.owner}%` }, ...pagination.where }
where: { ...pagination.where, owner: { _like: `%${newFilters.owner}%` } }
}))
}

setFilters(newFilters)
}

Expand Down

0 comments on commit 548d74b

Please sign in to comment.