Skip to content

Commit

Permalink
Fix state switch handler in validators list
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyandreevsky committed Sep 22, 2024
1 parent 376013e commit fba3396
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 fba3396

Please sign in to comment.