File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ import {
3030 updateCurrentAccount ,
3131 setWalletConnection ,
3232} from 'slices/walletSlice' ;
33- import { setActiveNetwork , setNetworks } from 'slices/networkSlice' ;
33+ import { setNetworksAndActiveNetwork } from 'slices/networkSlice' ;
3434import { disableLoading , enableLoadingWithMessage } from 'slices/UISlice' ;
3535import {
3636 Transaction ,
@@ -156,13 +156,18 @@ export const useStarkNetSnap = () => {
156156 console . error ( 'No networks found' ) ;
157157 return ;
158158 }
159- dispatch ( setNetworks ( networks ) ) ;
160159
161160 const currentNetwork = await getCurrentNetwork ( ) ;
162161 const idx = networks . findIndex (
163162 ( network ) => network . chainId === currentNetwork . chainId ,
164163 ) ;
165- dispatch ( setActiveNetwork ( idx ) ) ;
164+
165+ dispatch (
166+ setNetworksAndActiveNetwork ( {
167+ networks,
168+ activeNetwork : idx ,
169+ } ) ,
170+ ) ;
166171
167172 await initWalletData ( {
168173 chainId : currentNetwork . chainId ,
Original file line number Diff line number Diff line change @@ -15,12 +15,13 @@ export const networkSlice = createSlice({
1515 name : 'network' ,
1616 initialState,
1717 reducers : {
18- setNetworks : ( state , action ) => {
19- state . items = action . payload ;
20- } ,
2118 setActiveNetwork : ( state , action ) => {
2219 state . activeNetwork = action . payload ;
2320 } ,
21+ setNetworksAndActiveNetwork : ( state , action ) => {
22+ state . items = action . payload . networks ;
23+ state . activeNetwork = action . payload . activeNetwork ;
24+ } ,
2425 resetNetwork : ( ) => {
2526 return {
2627 ...initialState ,
@@ -29,7 +30,7 @@ export const networkSlice = createSlice({
2930 } ,
3031} ) ;
3132
32- export const { setNetworks , setActiveNetwork , resetNetwork } =
33+ export const { setActiveNetwork , setNetworksAndActiveNetwork , resetNetwork } =
3334 networkSlice . actions ;
3435
3536export default networkSlice . reducer ;
You can’t perform that action at this time.
0 commit comments