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 = {
page: 0,
values: props.initialValues || {},
values: {},
}
}
@ -146,7 +146,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
render() {
const {
steps, children, classes, disabledWhenValidating = false, testId,
steps, children, classes, disabledWhenValidating = false, testId, initialValues,
} = this.props
const { page, values } = this.state
const activePage = this.getActivePageFrom(children)
@ -155,7 +155,7 @@ class GnoStepper extends React.PureComponent<Props, State> {
return (
<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) => {
const disabled = disabledWhenValidating ? submitting || validating : submitting
const controls = (

View File

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

View File

@ -1,4 +1,4 @@
// @flow
export const FIELD_LOAD_NAME: string = 'name'
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)
expect(receiverFunds).toBe(tokensAmount)
})
})
})