diff --git a/src/components/forms/AddressInput/index.jsx b/src/components/forms/AddressInput/index.jsx
index cfbe55d7..ef6a3cc6 100644
--- a/src/components/forms/AddressInput/index.jsx
+++ b/src/components/forms/AddressInput/index.jsx
@@ -20,6 +20,7 @@ type Props = {
validators?: Function[],
inputAdornment?: React.Element,
defaultValue?: string,
+ disabled?: boolean,
}
const isValidEnsName = (name) => /^([\w-]+\.)+(eth|test|xyz|luxe)$/.test(name)
@@ -37,6 +38,7 @@ const AddressInput = ({
inputAdornment,
validators = [],
defaultValue,
+ disabled,
}: Props): React.Element<*> => (
<>
{async (value) => {
diff --git a/src/routes/safe/components/AddressBook/CreateEditEntryModal/index.jsx b/src/routes/safe/components/AddressBook/CreateEditEntryModal/index.jsx
index 2c96554c..9cac5a4b 100644
--- a/src/routes/safe/components/AddressBook/CreateEditEntryModal/index.jsx
+++ b/src/routes/safe/components/AddressBook/CreateEditEntryModal/index.jsx
@@ -35,7 +35,6 @@ type Props = {
newEntryModalHandler: Function,
editEntryModalHandler: Function,
entryToEdit?: AddressBookEntry,
- newEntryDefaultAddress: string | null,
}
const CreateEditEntryModalComponent = ({
@@ -44,7 +43,6 @@ const CreateEditEntryModalComponent = ({
classes,
newEntryModalHandler,
entryToEdit,
- newEntryDefaultAddress,
editEntryModalHandler,
}: Props) => {
const onFormSubmitted = (values) => {
@@ -111,6 +109,7 @@ const CreateEditEntryModalComponent = ({
fieldMutator={mutators.setOwnerAddress}
testId={CREATE_ENTRY_INPUT_ADDRESS_ID}
defaultValue={entryToEdit ? entryToEdit.entry.address : undefined}
+ disabled={!!entryToEdit}
/>
diff --git a/src/routes/safe/components/AddressBook/index.jsx b/src/routes/safe/components/AddressBook/index.jsx
index b3f4ec17..6fdb1535 100644
--- a/src/routes/safe/components/AddressBook/index.jsx
+++ b/src/routes/safe/components/AddressBook/index.jsx
@@ -59,7 +59,6 @@ const AddressBookTable = ({ classes }: Props) => {
)
const [deleteEntryModalOpen, setDeleteEntryModalOpen] = useState(false)
const [sendFundsModalOpen, setSendFundsModalOpen] = useState(false)
- const [defaultNewEntryAddress, setDefaultNewEntryAddress] = useState(null)
const entryAddressToEditOrCreateNew = useSelector(addressBookQueryParamsSelector)
@@ -78,7 +77,6 @@ const AddressBookTable = ({ classes }: Props) => {
setSelectedEntry({ entry: value, index: key })
} else {
// Create new entry
- setDefaultNewEntryAddress(entryAddressToEditOrCreateNew)
setSelectedEntry(null)
}
}
@@ -93,7 +91,6 @@ const AddressBookTable = ({ classes }: Props) => {
const newEntryModalHandler = (entry: AddressBookEntry) => {
setEditCreateEntryModalOpen(false)
dispatch(addAddressBookEntry(entry))
- setDefaultNewEntryAddress(null)
}
const editEntryModalHandler = (entry: AddressBookEntry) => {
@@ -174,7 +171,7 @@ const AddressBookTable = ({ classes }: Props) => {
className={classes.editEntryButton}
src={RenameOwnerIcon}
onClick={() => {
- setSelectedEntry({ entry: row })
+ setSelectedEntry({ entry: { ...row, isOwnerAddress: userOwner } })
setEditCreateEntryModalOpen(true)
}}
testId={EDIT_ENTRY_BUTTON}
@@ -224,7 +221,6 @@ const AddressBookTable = ({ classes }: Props) => {
newEntryModalHandler={newEntryModalHandler}
editEntryModalHandler={editEntryModalHandler}
entryToEdit={selectedEntry}
- newEntryDefaultAddress={defaultNewEntryAddress}
/>
setDeleteEntryModalOpen(false)}