Remove obsolete code
This commit is contained in:
parent
6c5c03b8c1
commit
027d6adc89
|
@ -29,8 +29,6 @@ const Address2Field = < T extends AddressFormValues | ContactFormValues >( {
|
|||
return objectHasProp( values, 'address_2' ) && values.address_2 !== '';
|
||||
}, [ values ] );
|
||||
|
||||
const [ hasFieldBeenModified, setHasFieldBeenModified ] = useState( false );
|
||||
|
||||
const isFieldRequired = field ? field.required : false;
|
||||
|
||||
const [ isFieldVisible, setFieldVisible ] = useState(
|
||||
|
@ -45,20 +43,6 @@ const Address2Field = < T extends AddressFormValues | ContactFormValues >( {
|
|||
[]
|
||||
);
|
||||
|
||||
useEffect( () => {
|
||||
/**
|
||||
* Determine if the address 2 input field should be shown based on the following conditions:
|
||||
*
|
||||
* 1. If the address 2 field is required.
|
||||
* 2. If the address 2 field has a value.
|
||||
* 3. If the seller has edited the address 2 field.
|
||||
*/
|
||||
const shouldShowField =
|
||||
isFieldRequired || hasFieldValue || hasFieldBeenModified;
|
||||
|
||||
setFieldVisible( shouldShowField );
|
||||
}, [ isFieldRequired, hasFieldValue, hasFieldBeenModified ] );
|
||||
|
||||
return (
|
||||
<Fragment key={ field.key }>
|
||||
{ isFieldVisible ? (
|
||||
|
@ -77,7 +61,6 @@ const Address2Field = < T extends AddressFormValues | ContactFormValues >( {
|
|||
...values,
|
||||
[ field.key ]: newValue,
|
||||
} );
|
||||
setHasFieldBeenModified( true );
|
||||
} }
|
||||
/>
|
||||
) : (
|
||||
|
|
Loading…
Reference in New Issue