Fix issue in sorting of taxonomy picker

This commit is contained in:
Elio Struyf
2021-10-12 10:50:42 +02:00
parent 8198ce2af3
commit f51fec5fb9
+2 -2
View File
@@ -83,7 +83,7 @@ export const TagPicker: React.FunctionComponent<ITagPickerProps> = (props: React
if (selectedItem) {
let value = selectedItem || "";
const item = options.find(o => o.toLowerCase() === selectedItem.toLowerCase());
const item = options.find(o => o?.toLowerCase() === selectedItem?.toLowerCase());
if (item) {
value = item;
}
@@ -187,7 +187,7 @@ export const TagPicker: React.FunctionComponent<ITagPickerProps> = (props: React
</Downshift>
<Tags
values={(selected || []).sort((a: string, b: string) => a.toLowerCase() < b.toLowerCase() ? -1 : 1 )}
values={(selected || []).sort((a: string, b: string) => a?.toLowerCase() < b?.toLowerCase() ? -1 : 1 )}
onRemove={onRemove}
onCreate={onCreate}
options={options}