From 895a33a8c4372fbf1a521ddad962559f6961cdaf Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Tue, 4 Jul 2023 11:55:20 +0300 Subject: [PATCH] Fix null value bug --- .../content/views/FormattingOptionsMultiSelect.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx b/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx index 3adf87a8a6..c0b9d683ef 100644 --- a/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx +++ b/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx @@ -8,7 +8,7 @@ import { import {IArticleField} from 'superdesk-api'; interface IProps { - value: Array; + value: Array | null; fieldId: string; fields: Dictionary; onChange(value: Array, fieldId: string): void; @@ -28,9 +28,11 @@ export class FormattingOptionsTreeSelect extends React.Component { ) .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 (