diff --git a/src/panelWebView/components/TagPicker.tsx b/src/panelWebView/components/TagPicker.tsx index 2afdba20..9be777ef 100644 --- a/src/panelWebView/components/TagPicker.tsx +++ b/src/panelWebView/components/TagPicker.tsx @@ -83,7 +83,7 @@ export const TagPicker: React.FunctionComponent = (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 = (props: React 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}