load safe fix wip

This commit is contained in:
mmv 2019-06-25 19:19:35 +04:00
parent b951ed8a2d
commit 2f9864bc61
4 changed files with 19 additions and 18 deletions

View File

@ -57,7 +57,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
this.state = { this.state = {
page: 0, page: 0,
values: props.initialValues || {}, values: {},
} }
} }
@ -146,7 +146,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
render() { render() {
const { const {
steps, children, classes, disabledWhenValidating = false, testId, steps, children, classes, disabledWhenValidating = false, testId, initialValues,
} = this.props } = this.props
const { page, values } = this.state const { page, values } = this.state
const activePage = this.getActivePageFrom(children) const activePage = this.getActivePageFrom(children)
@ -155,7 +155,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
return ( return (
<React.Fragment> <React.Fragment>
<GnoForm onSubmit={this.handleSubmit} initialValues={values} validation={this.validate} testId={testId}> <GnoForm onSubmit={this.handleSubmit} initialValues={values || initialValues} validation={this.validate} testId={testId}>
{(submitting: boolean, validating: boolean, ...rest: any) => { {(submitting: boolean, validating: boolean, ...rest: any) => {
const disabled = disabledWhenValidating ? submitting || validating : submitting const disabled = disabledWhenValidating ? submitting || validating : submitting
const controls = ( const controls = (

View File

@ -92,6 +92,8 @@ const calculateSafeValues = (owners: Array<string>, threshold: Number, values: O
} }
class OwnerListComponent extends React.PureComponent<Props, State> { class OwnerListComponent extends React.PureComponent<Props, State> {
static whyDidYouRender = true
state = { state = {
owners: [], owners: [],
} }
@ -113,7 +115,7 @@ class OwnerListComponent extends React.PureComponent<Props, State> {
if (!owners) { if (!owners) {
return return
} }
console.log('eee')
if (this.mounted) { if (this.mounted) {
this.setState(() => ({ owners: owners.sort() })) this.setState(() => ({ owners: owners.sort() }))
} }
@ -126,6 +128,7 @@ class OwnerListComponent extends React.PureComponent<Props, State> {
render() { render() {
const { network, classes } = this.props const { network, classes } = this.props
const { owners } = this.state const { owners } = this.state
console.log(owners)
return ( return (
<React.Fragment> <React.Fragment>
@ -141,8 +144,8 @@ class OwnerListComponent extends React.PureComponent<Props, State> {
</Row> </Row>
<Hairline /> <Hairline />
<Block margin="md" padding="md"> <Block margin="md" padding="md">
{owners.map((x, index) => ( {owners.map((address, index) => (
<Row key={owners[index].address} className={classes.owner}> <Row key={address} className={classes.owner}>
<Col xs={4}> <Col xs={4}>
<Field <Field
className={classes.name} className={classes.name}
@ -150,24 +153,24 @@ class OwnerListComponent extends React.PureComponent<Props, State> {
component={TextField} component={TextField}
type="text" type="text"
validate={required} validate={required}
defaultValue={`Owner #${index + 1}`} initialValue={`Owner #${index + 1}`}
placeholder="Owner Name*" placeholder="Owner Name*"
text="Owner Name" text="Owner Name"
/> />
</Col> </Col>
<Col xs={7}> <Col xs={7}>
<Row className={classes.ownerAddresses}> <Row className={classes.ownerAddresses}>
<Identicon address={owners[index]} diameter={32} /> <Identicon address={address} diameter={32} />
<Paragraph size="md" color="disabled" noMargin className={classes.address}> <Paragraph size="md" color="disabled" noMargin className={classes.address}>
{owners[index]} {address}
</Paragraph> </Paragraph>
<Link className={classes.open} to={getEtherScanLink(owners[index], network)} target="_blank"> <Link className={classes.open} to={getEtherScanLink(address, network)} target="_blank">
<OpenInNew style={openIconStyle} /> <OpenInNew style={openIconStyle} />
</Link> </Link>
</Row> </Row>
</Col> </Col>
</Row> </Row>
)) } ))}
</Block> </Block>
</React.Fragment> </React.Fragment>
) )
@ -179,13 +182,11 @@ const OwnerListPage = withStyles(styles)(OwnerListComponent)
const OwnerList = ({ updateInitialProps }: Object, network: string) => (controls: React$Node, { values }: Object) => ( const OwnerList = ({ updateInitialProps }: Object, network: string) => (controls: React$Node, { values }: Object) => (
<React.Fragment> <React.Fragment>
<OpenPaper controls={controls} padding={false}> <OpenPaper controls={controls} padding={false}>
<OwnerListPage <OwnerListPage network={network} updateInitialProps={updateInitialProps} values={values} />
network={network}
updateInitialProps={updateInitialProps}
values={values}
/>
</OpenPaper> </OpenPaper>
</React.Fragment> </React.Fragment>
) )
OwnerList.whyDidYouRender = true
export default OwnerList export default OwnerList

View File

@ -1,4 +1,4 @@
// @flow // @flow
export const FIELD_LOAD_NAME: string = 'name' export const FIELD_LOAD_NAME: string = 'name'
export const FIELD_LOAD_ADDRESS: string = 'address' export const FIELD_LOAD_ADDRESS: string = 'address'
export const THRESHOLD: Number = 'threshold' export const THRESHOLD: string = 'threshold'

View File

@ -119,4 +119,4 @@ describe('DOM > Feature > Funds', () => {
const receiverFunds = await calculateBalanceOf(tokenAddress, tokenReceiver, 18) const receiverFunds = await calculateBalanceOf(tokenAddress, tokenReceiver, 18)
expect(receiverFunds).toBe(tokensAmount) expect(receiverFunds).toBe(tokensAmount)
}) })
}) })