Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryNguyen5 committed Apr 6, 2018
1 parent 26daa58 commit 21eda0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 1 addition & 2 deletions common/components/Header/components/CustomNodeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from 'selectors/config';
import { Input, Dropdown } from 'components/ui';
import './CustomNodeModal.scss';
import { shepherdProvider, shepherd, makeProviderConfig } from 'libs/nodes';
import { shepherdProvider } from 'libs/nodes';

const CUSTOM = { label: 'Custom', value: 'custom' };

Expand Down Expand Up @@ -341,7 +341,6 @@ class CustomNodeModal extends React.Component<Props, State> {

private saveAndAdd = () => {
const node = this.makeCustomNodeConfigFromState();
shepherd.useProvider('myccustom', node.id, makeProviderConfig({ network: node.network }), node);

if (this.state.network === CUSTOM.value) {
const network = this.makeCustomNetworkConfigFromState();
Expand Down
14 changes: 11 additions & 3 deletions common/sagas/config/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
isAutoNode,
shepherd,
shepherdProvider,
stripWeb3Network
stripWeb3Network,
makeProviderConfig
} from 'libs/nodes';

export function* pollOfflineStatus(): SagaIterator {
Expand Down Expand Up @@ -176,7 +177,14 @@ export function* handleNodeChangeIntent({
}
}

export function* switchToNewNode(action: AddCustomNodeAction): SagaIterator {
export function* handleAddCustomNode(action: AddCustomNodeAction): SagaIterator {
const { payload: { config } } = action;
shepherd.useProvider(
'myccustom',
config.id,
makeProviderConfig({ network: config.network }),
config
);
yield put(changeNodeIntent(action.payload.id));
}

Expand Down Expand Up @@ -210,5 +218,5 @@ export const node = [
takeEvery(TypeKeys.CONFIG_NODE_CHANGE_FORCE, handleNodeChangeForce),
takeLatest(TypeKeys.CONFIG_POLL_OFFLINE_STATUS, handlePollOfflineStatus),
takeEvery(TypeKeys.CONFIG_LANGUAGE_CHANGE, reload),
takeEvery(TypeKeys.CONFIG_ADD_CUSTOM_NODE, switchToNewNode)
takeEvery(TypeKeys.CONFIG_ADD_CUSTOM_NODE, handleAddCustomNode)
];

1 comment on commit 21eda0c

@wbobeirne
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Please sign in to comment.