Skip to content

Commit e6ec02d

Browse files
committed
fix(FilePickerBuilder): correctly return array / plain value depending on multiselect
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 11732c7 commit e6ec02d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/filepicker-builder.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ export class FilePicker<IsMultiSelect extends boolean> {
9898
public async pick(): Promise<IsMultiSelect extends true ? string[] : string> {
9999
const nodes = await this.pickNodes()
100100
if (this.multiSelect) {
101-
return (nodes[0]?.path ?? '/') as (IsMultiSelect extends true ? string[] : string)
101+
return nodes.map((node) => node.path) as (IsMultiSelect extends true ? string[] : string)
102102
}
103-
return nodes.map((node) => node.path) as (IsMultiSelect extends true ? string[] : string)
103+
const path = nodes[0]?.path ?? '/'
104+
return path as (IsMultiSelect extends true ? string[] : string)
104105
}
105106
}
106107

0 commit comments

Comments
 (0)