Skip to content

Commit

Permalink
Fixes issue pnp#1510
Browse files Browse the repository at this point in the history
  • Loading branch information
GuidoZam committed Jul 19, 2023
1 parent 04f3e60 commit 8013c84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/controls/dynamicForm/dynamicField/DynamicField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { IPickerTerms, TaxonomyPicker } from '../../taxonomyPicker';
import styles from '../DynamicForm.module.scss';
import { IDynamicFieldProps } from './IDynamicFieldProps';
import { IDynamicFieldState } from './IDynamicFieldState';
import { isArray } from 'lodash';


export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFieldState> {
Expand Down Expand Up @@ -646,14 +647,16 @@ export class DynamicField extends React.Component<IDynamicFieldProps, IDynamicFi

try {
let selectedItemArr;

if (changedValue === null && this.props.fieldDefaultValue !== null) {
selectedItemArr = [];
this.props.fieldDefaultValue.forEach(element => {
selectedItemArr.push(element);
});
}
else
selectedItemArr = !changedValue ? [] : changedValue;
else {
selectedItemArr = !changedValue ? [] : isArray(changedValue) ? changedValue : [ changedValue ];
}

if (item.selected) {
selectedItemArr.push(item.key);
Expand Down

0 comments on commit 8013c84

Please sign in to comment.