1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

send user to account page upon adding a custom network (#11945)

This commit is contained in:
Alex Donesky 2021-09-03 10:52:37 -05:00 committed by GitHub
parent b5b2c3fdb0
commit 3358ac2c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -49,7 +49,7 @@ describe('Stores custom RPC history', function () {
await chainIdInput.sendKeys(chainId.toString());
await driver.clickElement('.network-form__footer .btn-secondary');
await driver.findElement({ text: networkName, tag: 'div' });
await driver.findElement({ text: networkName, tag: 'span' });
},
);
});

View File

@ -41,7 +41,7 @@ export default class NetworkForm extends PureComponent {
blockExplorerUrl: PropTypes.string,
rpcPrefs: PropTypes.object,
networksToRender: PropTypes.array,
isFullScreen: PropTypes.bool,
onAddNetwork: PropTypes.func.isRequired,
};
static defaultProps = {
@ -165,7 +165,7 @@ export default class NetworkForm extends PureComponent {
rpcUrl: propsRpcUrl,
editRpc,
rpcPrefs = {},
onClear,
onAddNetwork,
networksTabIsInAddMode,
} = this.props;
const {
@ -200,7 +200,7 @@ export default class NetworkForm extends PureComponent {
}
if (networksTabIsInAddMode) {
onClear();
onAddNetwork();
}
} catch (error) {
this.setState({
@ -211,9 +211,9 @@ export default class NetworkForm extends PureComponent {
};
onCancel = () => {
const { isFullScreen, networksTabIsInAddMode, onClear } = this.props;
const { networksTabIsInAddMode, onClear } = this.props;
if (networksTabIsInAddMode || !isFullScreen) {
if (networksTabIsInAddMode) {
onClear();
} else {
this.resetForm();

View File

@ -7,6 +7,7 @@ import LockIcon from '../../../components/ui/lock-icon';
import {
NETWORKS_ROUTE,
NETWORKS_FORM_ROUTE,
DEFAULT_ROUTE,
} from '../../../helpers/constants/routes';
import ColorIndicator from '../../../components/ui/color-indicator';
import { COLORS, SIZES } from '../../../helpers/constants/design-system';
@ -212,10 +213,13 @@ export default class NetworksTab extends PureComponent {
onClear={(shouldUpdateHistory = true) => {
setNetworksTabAddMode(false);
setSelectedSettingsRpcUrl('');
if (shouldUpdateHistory && !isFullScreen) {
if (shouldUpdateHistory) {
history.push(NETWORKS_ROUTE);
}
}}
onAddNetwork={() => {
history.push(DEFAULT_ROUTE);
}}
showConfirmDeleteNetworkModal={showConfirmDeleteNetworkModal}
viewOnly={viewOnly}
isCurrentRpcTarget={providerUrl === rpcUrl}