From cac5bace38c11434bae1e7894918976630016103 Mon Sep 17 00:00:00 2001 From: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com> Date: Thu, 1 Dec 2022 19:06:49 +0000 Subject: [PATCH] fix: multiselect crashing (#18577) --- .../src/widgets/MultiSelectWidgetV2/widget/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx index 2d1812878c..80a1be2e21 100644 --- a/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx +++ b/app/client/src/widgets/MultiSelectWidgetV2/widget/index.tsx @@ -700,6 +700,9 @@ class MultiSelectWidget extends BaseWidget< // { label , value } is needed in the widget mergeLabelAndValue = (): LabelInValueType[] => { + if (!this.props.selectedOptionLabels || !this.props.selectedOptionValues) { + return []; + } const labels = [...this.props.selectedOptionLabels]; const values = [...this.props.selectedOptionValues]; return values.map((value, index) => ({ @@ -747,8 +750,8 @@ export interface MultiSelectWidgetProps extends WidgetProps { isLoading: boolean; selectedOptions: LabelInValueType[]; filterText: string; - selectedOptionValues: string[]; - selectedOptionLabels: string[]; + selectedOptionValues?: string[]; + selectedOptionLabels?: string[]; serverSideFiltering: boolean; onFilterUpdate: string; allowSelectAll?: boolean;