Skip to content

Commit

Permalink
Merge pull request #266 from pshenmic/feat/redesign
Browse files Browse the repository at this point in the history
Fix state switch handler in validators list
  • Loading branch information
alexeyandreevsky authored Sep 22, 2024
2 parents f8bfe28 + fba3396 commit 82306f6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/frontend/src/app/validators/Validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ function Validators ({ defaultPage = 1, defaultPageSize, defaultIsActive }) {
router.push(`${pathname}?${urlParameters.toString()}`, { scroll: false })
}, [currentPage, pageSize, activeState])

const isActiveSwitchHandler = (newActiveState) => {
useEffect(() => {
setCurrentPage(0)
setActiveState(newActiveState.toLowerCase())
fetchData(1, pageSize, newActiveState)
}
fetchData(1, pageSize, activeState)
}, [activeState])

return (
<Container
Expand All @@ -102,7 +101,7 @@ function Validators ({ defaultPage = 1, defaultPageSize, defaultIsActive }) {
{ title: 'Queued' }
]}
defaultValue={activeState}
onChange={activeOption => isActiveSwitchHandler(activeOption)}
onChange={activeOption => setActiveState(activeOption.toLowerCase())}
/>
</Box>

Expand Down

0 comments on commit 82306f6

Please sign in to comment.