Remove obsolete code

This commit is contained in:
Niels Lange 2024-05-17 17:04:47 +07:00
parent 6c5c03b8c1
commit 027d6adc89
No known key found for this signature in database
GPG Key ID: 1C3F03249476BAC0
1 changed files with 0 additions and 17 deletions

View File

@ -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 );
} }
/>
) : (