1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Ensure that if max is selected in send flow, the correct value is set after network switch (#15444)

This commit is contained in:
Dan J Miller 2022-08-03 14:24:35 -02:30
parent b6d587223b
commit d5b95d6e44
2 changed files with 7 additions and 4 deletions

View File

@ -1565,6 +1565,9 @@ const slice = createSlice({
}, },
}); });
} }
if (state.amountMode === AMOUNT_MODES.MAX) {
slice.caseReducers.updateAmountToMax(state);
}
slice.caseReducers.validateAmountField(state); slice.caseReducers.validateAmountField(state);
slice.caseReducers.validateGasField(state); slice.caseReducers.validateGasField(state);
slice.caseReducers.validateSendState(state); slice.caseReducers.validateSendState(state);

View File

@ -1442,6 +1442,10 @@ export function updateMetamaskState(newState) {
}, },
}); });
} }
dispatch({
type: actionConstants.UPDATE_METAMASK_STATE,
value: newState,
});
if (provider.chainId !== newProvider.chainId) { if (provider.chainId !== newProvider.chainId) {
dispatch({ dispatch({
type: actionConstants.CHAIN_CHANGED, type: actionConstants.CHAIN_CHANGED,
@ -1453,10 +1457,6 @@ export function updateMetamaskState(newState) {
// progress. // progress.
dispatch(initializeSendState({ chainHasChanged: true })); dispatch(initializeSendState({ chainHasChanged: true }));
} }
dispatch({
type: actionConstants.UPDATE_METAMASK_STATE,
value: newState,
});
}; };
} }