File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
projects/netgrif-components-core/src/lib/data-fields/i18n-field/models Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ export class I18nField extends DataField<I18nFieldValue> {
36
36
}
37
37
38
38
private static translationsEquality ( a : I18nFieldValue , b : I18nFieldValue ) : boolean {
39
- const aKeys = Object . keys ( a . translations ) . sort ( ) ;
40
- const bKeys = Object . keys ( b . translations ) . sort ( ) ;
39
+ const aKeys = ! ! a . translations ? Object . keys ( a . translations ) . sort ( ) : [ ] ;
40
+ const bKeys = ! ! b . translations ? Object . keys ( b . translations ) . sort ( ) : [ ] ;
41
41
if ( aKeys . length !== bKeys . length
42
42
|| ! aKeys . every ( ( element , index ) => {
43
43
return element === bKeys [ index ] ;
@@ -166,14 +166,14 @@ export class I18nField extends DataField<I18nFieldValue> {
166
166
private validTranslationRequired ( countries : Array < string > ) : ValidatorFn {
167
167
return ( fc : FormControl ) : { [ key : string ] : any } | null => {
168
168
return countries . every ( languageCode => languageCode in fc . value . translations )
169
- ? ( null ) : ( { translationRequired : true } ) ;
169
+ ? null : ( { translationRequired : true } ) ;
170
170
} ;
171
171
}
172
172
173
173
private validTranslationOnly ( countries : Array < string > ) : ValidatorFn {
174
174
return ( fc : FormControl ) : { [ key : string ] : any } | null => {
175
175
return Object . keys ( fc . value . translations ) . every ( translation => countries . includes ( translation ) )
176
- ? ( null ) : ( { translationOnly : true } ) ;
176
+ ? null : ( { translationOnly : true } ) ;
177
177
} ;
178
178
}
179
179
You can’t perform that action at this time.
0 commit comments