From 740a523fad3aec2d159b14da0ebba2937c2d82b1 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Tue, 18 Apr 2023 15:14:37 +0200 Subject: [PATCH] :bug: Adding a commentary --- src/front/Components/DesignSystem/MultiSelect/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/front/Components/DesignSystem/MultiSelect/index.tsx b/src/front/Components/DesignSystem/MultiSelect/index.tsx index 7c7b3cf3..cb1ca3cc 100644 --- a/src/front/Components/DesignSystem/MultiSelect/index.tsx +++ b/src/front/Components/DesignSystem/MultiSelect/index.tsx @@ -75,9 +75,12 @@ export default class MultiSelect extends React.Component { public override componentDidMount(): void { if (this.props.defaultValue) { + // If default value contains multiple IOptions if (Array.isArray(this.props.defaultValue)) { this.setState({ selectedOptions: this.props.defaultValue }); } + + // If default value is a single IOption if ("label" in this.props.defaultValue) { this.setState({ selectedOptions: [this.props.defaultValue] }); }