@@ -5,7 +5,7 @@ import dayjs from 'dayjs'
55import isEmpty from 'lodash/isEmpty'
66import { Property } from '@condo/domains/property/utils/clientSchema'
77
8- export const usePropertyValidations = ( { organizationId, addressValidatorError } ) => {
8+ export const usePropertyValidations = ( { organizationId, addressValidatorError, address } ) => {
99 const intl = useIntl ( )
1010 const SamePropertyErrorMsg = intl . formatMessage ( { id : 'pages.condo.property.warning.modal.SamePropertyErrorMsg' } )
1111 const WrongYearErrorMsg = intl . formatMessage ( { id : 'pages.condo.property.form.YearValidationError' } )
@@ -19,6 +19,7 @@ export const usePropertyValidations = ({ organizationId, addressValidatorError }
1919 const addressValidator : Rule = useMemo ( ( ) => ( {
2020 validator : async ( _ , value ) => {
2121 if ( isEmpty ( value ) ) return Promise . resolve ( )
22+ if ( ! isEmpty ( address ) && address === value ) return Promise . resolve ( )
2223 if ( addressValidatorError ) return Promise . reject ( addressValidatorError )
2324
2425 const { data : { objs } } = await refetch ( {
@@ -33,7 +34,7 @@ export const usePropertyValidations = ({ organizationId, addressValidatorError }
3334 }
3435 return Promise . resolve ( )
3536 } ,
36- } ) , [ addressValidatorError , SamePropertyErrorMsg , refetch , organizationId ] )
37+ } ) , [ addressValidatorError , SamePropertyErrorMsg , refetch , organizationId , address ] )
3738
3839 const yearOfConstructionValidator : Rule = useMemo ( ( ) => ( {
3940 validator : ( _ , value ) => {
0 commit comments