@@ -58,7 +58,7 @@ export const TemplateDropdown = (props: TemplateDropdownProps) => {
5858 // Group templates by category id
5959 const groupedTemplates = templates . reduce (
6060 ( acc : UseCaseTemplate [ ] [ ] , template : UseCaseTemplate ) => {
61- const categoryId = template . category . id ?? - 1 ;
61+ const categoryId = template ? .category ? .id ?? - 1 ;
6262 if ( ! acc [ categoryId as number ] ) {
6363 acc [ categoryId as number ] = [ ] ;
6464 }
@@ -78,7 +78,7 @@ export const TemplateDropdown = (props: TemplateDropdownProps) => {
7878 ( value : string ) => {
7979 const matchedOptions = groupedTemplates . reduce (
8080 ( acc : UseCaseTemplate [ ] [ ] , group : UseCaseTemplate [ ] ) => {
81- const categoryId = group [ 0 ] . category . id ?? - 1 ;
81+ const categoryId = group [ 0 ] ? .category ? .id ?? - 1 ;
8282 const matchGroup = group . filter (
8383 ( template : UseCaseTemplate ) =>
8484 template . title
@@ -145,7 +145,7 @@ export const TemplateDropdown = (props: TemplateDropdownProps) => {
145145 { matchingOptions . length ? (
146146 matchingOptions . map ( ( group : UseCaseTemplate [ ] ) => (
147147 < >
148- < GroupLabel disabled > { group [ 0 ] . category . name } </ GroupLabel >
148+ < GroupLabel disabled > { group [ 0 ] ? .category ? .name } </ GroupLabel >
149149 { group . map ( ( template : UseCaseTemplate ) => (
150150 < StyledItem key = { `template_${ template . id } ` } value = { template } >
151151 < ItemContent
0 commit comments