Merge pull request #1920 from gnosis/hotfix/v3.0.1

Hotfix v3.0.1
This commit is contained in:
Daniel Sanchez 2021-02-17 14:03:31 +01:00 committed by GitHub
commit a4e3c82ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
"name": "safe-react",
"version": "3.0.0",
"version": "3.0.1",
"description": "Allowing crypto users manage funds in a safer way",
"website": "https://github.com/gnosis/safe-react#readme",
"bugs": {

View File

@ -2,7 +2,7 @@ import IconButton from '@material-ui/core/IconButton'
import MenuItem from '@material-ui/core/MenuItem'
import { makeStyles } from '@material-ui/core/styles'
import Close from '@material-ui/icons/Close'
import React, { useEffect, useState } from 'react'
import React, { ReactElement, useEffect, useState } from 'react'
import { useDispatch } from 'react-redux'
import { List } from 'immutable'
@ -44,12 +44,13 @@ export const ChangeThresholdModal = ({
owners,
safeAddress,
threshold = 1,
}: ChangeThresholdModalProps): React.ReactElement => {
}: ChangeThresholdModalProps): ReactElement => {
const classes = useStyles()
const dispatch = useDispatch()
const [data, setData] = useState('')
const [manualSafeTxGas, setManualSafeTxGas] = useState(0)
const [manualGasPrice, setManualGasPrice] = useState<string | undefined>()
const [editedThreshold, setEditedThreshold] = useState<number>(threshold)
const {
gasCostFormatted,
@ -71,7 +72,7 @@ export const ChangeThresholdModal = ({
let isCurrent = true
const calculateChangeThresholdData = async () => {
const safeInstance = await getGnosisSafeInstanceAt(safeAddress)
const txData = safeInstance.methods.changeThreshold(threshold).encodeABI()
const txData = safeInstance.methods.changeThreshold(editedThreshold).encodeABI()
if (isCurrent) {
setData(txData)
}
@ -81,7 +82,7 @@ export const ChangeThresholdModal = ({
return () => {
isCurrent = false
}
}, [safeAddress, threshold])
}, [safeAddress, editedThreshold])
const getParametersStatus = () => (threshold > 1 ? 'ETH_DISABLED' : 'ENABLED')
@ -135,7 +136,7 @@ export const ChangeThresholdModal = ({
</IconButton>
</Row>
<Hairline />
<GnoForm initialValues={{ threshold: threshold.toString(), txParameters }} onSubmit={handleSubmit}>
<GnoForm initialValues={{ threshold: editedThreshold.toString(), txParameters }} onSubmit={handleSubmit}>
{() => (
<>
<Block className={classes.modalContent}>
@ -147,6 +148,9 @@ export const ChangeThresholdModal = ({
<Field
data-testid="threshold-select-input"
name={THRESHOLD_FIELD_NAME}
onChange={({ target }) => {
setEditedThreshold(parseInt(target.value))
}}
render={(props) => (
<>
<SelectField {...props} disableError>
@ -177,7 +181,6 @@ export const ChangeThresholdModal = ({
<TxParametersDetail
txParameters={txParameters}
onEdit={toggleEditMode}
compact={true}
parametersStatus={getParametersStatus()}
isTransactionCreation={isCreation}
isTransactionExecution={isExecution}

View File

@ -50,13 +50,6 @@ export const EditableTxParameters = ({
toggleEditMode((prev) => !prev)
}
// Sends a callback with the last values of txParameters
useEffect(() => {
if (!isEditMode && closeEditModalCallback) {
closeEditModalCallback(txParameters)
}
}, [isEditMode, closeEditModalCallback, txParameters])
const closeEditFormHandler = (txParameters?: TxParameters) => {
if (txParameters) {
setUseManualValues(true)
@ -65,6 +58,7 @@ export const EditableTxParameters = ({
setEthGasLimit(txParameters.ethGasLimit)
setEthGasPrice(txParameters.ethGasPrice)
setEthNonce(txParameters.ethNonce)
closeEditModalCallback && closeEditModalCallback(txParameters)
}
toggleStatus()
}