@@ -23,6 +23,7 @@ const CosmosApproveProposalslPage = () => {
23
23
const itemsPerPageLimit = 10 ;
24
24
const [ itemsListOffset , setItemsListOffset ] = useState ( 0 ) ;
25
25
const chainId = state . activeCosmosChain . chainId ;
26
+ const [ fetchingData , setFetchingData ] = useState ( false ) ;
26
27
27
28
const handleInjectiveApprove = async ( proposalId : number ) => {
28
29
const chainId = state . activeCosmosChain . chainId ;
@@ -121,6 +122,7 @@ const CosmosApproveProposalslPage = () => {
121
122
} ;
122
123
123
124
const getProposals = async ( limit : number = 10 , offset : number = 0 ) => {
125
+ setFetchingData ( true ) ;
124
126
const txMsg = {
125
127
list_proposals : {
126
128
limit : limit ,
@@ -133,6 +135,7 @@ const CosmosApproveProposalslPage = () => {
133
135
const filteredProposals = data . proposals . filter ( ( proposal : Proposal ) => proposal . status === ProposalStatus . open ) ;
134
136
setProposalList ( filteredProposals ) ;
135
137
}
138
+ setFetchingData ( false ) ;
136
139
} ;
137
140
138
141
const handlePaginationChanges = ( offset : number ) => {
@@ -145,13 +148,18 @@ const CosmosApproveProposalslPage = () => {
145
148
}
146
149
} , [ itemsListOffset , chainId , address ] ) ;
147
150
151
+ useEffect ( ( ) => {
152
+ setProposalList ( [ ] ) ;
153
+ } , [ chainId ] ) ;
154
+
148
155
return (
149
156
< div className = "cosmos-approval-page w-full m-auto bg-[rgba(255,255,255,0.5)] p-4 rounded flex flex-col items-center" >
150
157
< div className = "mt-4 w-full max-w-[1600px]" >
151
158
< CosmosProposalsTable
152
159
proposals = { proposalList }
153
160
limit = { itemsPerPageLimit }
154
161
offset = { itemsListOffset }
162
+ loading = { fetchingData }
155
163
handleOffsetChange = { handlePaginationChanges }
156
164
approveAction = { handleApproveClick }
157
165
/>
0 commit comments