Skip to content

Commit

Permalink
Update validateErrorList
Browse files Browse the repository at this point in the history
  • Loading branch information
anicyne committed Dec 21, 2023
1 parent 60ad8ff commit 9905d54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions packages/components/src/components/form/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { translate } from '../../i18n';
import { Stringified } from '../../types/common';
import { watchBoolean, watchString } from '../../utils/prop.validators';
import { API, KoliBriFormCallbacks, States } from './types';
import { ErrorListPropType } from '../../types/props/error-list';
import { ErrorListPropType, validateErrorList } from '../../types/props/error-list';

/**
* @slot - Inhalt der Form.
Expand Down Expand Up @@ -111,12 +111,7 @@ export class KolForm implements API {

@Watch('_errorList')
public validateErrorList(value?: ErrorListPropType[]): void {
if (typeof value === 'object' && value !== null) {
this.state = {
...this.state,
_errorList: value,
};
}
validateErrorList(this, value);
}

public componentWillLoad(): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/types/props/error-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export type PropErrorList = {
};

/* validator */
export const validateAccessKey = (component: Generic.Element.Component, value?: ErrorListPropType): void => {
export const validateErrorList = (component: Generic.Element.Component, value?: ErrorListPropType[]): void => {
watchValidator(component, 'errorList', (value): boolean => typeof value === 'object', new Set(['Object']), value);
};

0 comments on commit 9905d54

Please sign in to comment.