Skip to content

Commit b37724e

Browse files
committed
fix empty optiongroups
1 parent fd3a56a commit b37724e

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/components/shared/inputOption.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,27 @@ export interface InputOption {
99
}
1010

1111
export const buildInputOptions = (inputOptions: InputOption[]): Option[] =>
12-
inputOptions?.map(inputOption => {
13-
if (!inputOption) {
14-
return;
15-
}
16-
const option: Option = {
17-
text: inputOption.text,
18-
};
19-
if (inputOption.url) {
20-
option.url = inputOption.url;
21-
}
22-
if (inputOption.value) {
23-
option.value = inputOption.value;
24-
}
25-
if (inputOption.description) {
26-
option.description = {
27-
text: inputOption.description,
28-
type: 'plain_text',
29-
emoji: true,
30-
};
31-
}
32-
return option;
33-
}) ?? [];
12+
inputOptions
13+
? inputOptions.map(inputOption => {
14+
if (!inputOption) {
15+
return;
16+
}
17+
const option: Option = {
18+
text: inputOption.text,
19+
};
20+
if (inputOption.url) {
21+
option.url = inputOption.url;
22+
}
23+
if (inputOption.value) {
24+
option.value = inputOption.value;
25+
}
26+
if (inputOption.description) {
27+
option.description = {
28+
text: inputOption.description,
29+
type: 'plain_text',
30+
emoji: true,
31+
};
32+
}
33+
return option;
34+
})
35+
: [];

0 commit comments

Comments
 (0)