Skip to content

Commit

Permalink
Fix null value bug (#4283)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored Jul 4, 2023
1 parent dd59331 commit 7919f63
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import {IArticleField} from 'superdesk-api';

interface IProps {
value: Array<string>;
value: Array<string> | null;
fieldId: string;
fields: Dictionary<string, IArticleField>;
onChange(value: Array<string>, fieldId: string): void;
Expand All @@ -28,9 +28,11 @@ export class FormattingOptionsTreeSelect extends React.Component<IProps> {
)
.map(([notTranslatedOption, translatedOption]) => ({value: [notTranslatedOption, translatedOption]}));

const values = formattingOptions
.filter((option) => this.props.value.includes(option.value[0]))
.map((option) => option.value);
const values = this.props.value != null
? formattingOptions
.filter((option) => this.props.value.includes(option.value[0]))
.map((option) => option.value)
: [];

return (
<TreeSelect
Expand Down

0 comments on commit 7919f63

Please sign in to comment.