@@ -22,7 +22,6 @@ import {
2222 DashboardGovernanceActionsVotedOn ,
2323} from "@organisms" ;
2424import { Button } from "@atoms" ;
25- import usePrevious from "@/hooks/usePrevious" ;
2625
2726type TabPanelProps = {
2827 children ?: React . ReactNode ;
@@ -85,21 +84,11 @@ export const DashboardGovernanceActions = () => {
8584 const queryFilters =
8685 chosenFilters . length > 0 ? chosenFilters : defaultCategories ;
8786
88- const prevFilters = usePrevious ( queryFilters ) ;
89- const prevSorting = usePrevious ( chosenSorting ) ;
90-
91- const stableFilters = isAdjusting
92- ? prevFilters ?? queryFilters
93- : queryFilters ;
94- const stableSorting = isAdjusting
95- ? prevSorting ?? chosenSorting
96- : chosenSorting ;
97-
9887 const { proposals, isProposalsLoading } = useGetProposalsQuery ( {
99- filters : stableFilters ,
100- sorting : stableSorting ,
88+ filters : queryFilters ,
89+ sorting : chosenSorting ,
10190 searchPhrase : debouncedSearchText ,
102- enabled : voter ?. isRegisteredAsDRep || voter ?. isRegisteredAsSoleVoter ,
91+ enabled : ! isAdjusting ,
10392 } ) ;
10493 const { data : votes , areDRepVotesLoading } = useGetDRepVotesQuery (
10594 queryFilters ,
@@ -109,31 +98,31 @@ export const DashboardGovernanceActions = () => {
10998
11099 // White Magic :)
111100 const shouldFilter =
112- voter ?. isRegisteredAsDRep || voter ?. isRegisteredAsSoleVoter ;
113-
114- const filteredProposals = useMemo ( ( ) => {
115- if ( ! shouldFilter || ! proposals || ! votes ) return proposals ;
116-
117- return proposals
118- . map ( ( proposalCategory ) => {
119- const filteredActions = proposalCategory . actions . filter ( ( action ) => {
120- const hasVote = votes . some ( ( voteCategory ) =>
121- voteCategory . actions . some (
122- ( voteAction ) =>
123- voteAction . proposal . txHash === action . txHash &&
124- voteAction . proposal . index === action . index ,
125- ) ,
126- ) ;
127- return ! hasVote ;
128- } ) ;
129-
130- return {
131- ...proposalCategory ,
132- actions : filteredActions ,
133- } ;
134- } )
135- . filter ( ( category ) => category . actions . length > 0 ) ;
136- } , [ proposals , votes , shouldFilter ] ) ;
101+ voter ?. isRegisteredAsDRep || voter ?. isRegisteredAsSoleVoter ;
102+
103+ const filteredProposals = useMemo ( ( ) => {
104+ if ( ! shouldFilter || ! proposals || ! votes ) return proposals ;
105+
106+ return proposals
107+ . map ( ( proposalCategory ) => {
108+ const filteredActions = proposalCategory . actions . filter ( ( action ) => {
109+ const hasVote = votes . some ( ( voteCategory ) =>
110+ voteCategory . actions . some (
111+ ( voteAction ) =>
112+ voteAction . proposal . txHash === action . txHash &&
113+ voteAction . proposal . index === action . index ,
114+ ) ,
115+ ) ;
116+ return ! hasVote ;
117+ } ) ;
118+
119+ return {
120+ ...proposalCategory ,
121+ actions : filteredActions ,
122+ } ;
123+ } )
124+ . filter ( ( category ) => category . actions . length > 0 ) ;
125+ } , [ proposals , votes , shouldFilter ] ) ;
137126
138127 const { state } = useLocation ( ) ;
139128 const [ content , setContent ] = useState < number > (
0 commit comments