File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/components/ReferenceDirectoryWithFilter Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -72,18 +72,25 @@ export const ReferenceDirectoryWithFilter = ({
7272
7373 return categoryData . reduce ( ( acc : FilteredCategoryData [ ] , category ) => {
7474 const filteredSubcats = category . subcats . reduce (
75- ( subAcc , subcat ) => {
75+ ( subAcc : typeof category . subcats , subcat ) => {
7676 const filteredEntries = subcat . entries . filter ( ( entry ) =>
7777 entry . data . title
7878 . toLowerCase ( )
7979 . includes ( searchKeyword . toLowerCase ( ) ) ,
8080 ) ;
81+ if (
82+ subcat . entry &&
83+ subcat . entry . data . title . toLowerCase ( ) . includes ( searchKeyword . toLowerCase ( ) )
84+ ) {
85+ filteredEntries . push ( subcat . entry ) ;
86+ }
87+
8188 if ( filteredEntries . length > 0 ) {
8289 subAcc . push ( { ...subcat , entries : filteredEntries } ) ;
8390 }
8491 return subAcc ;
8592 } ,
86- [ ] as typeof category . subcats ,
93+ [ ] ,
8794 ) ;
8895
8996 if ( filteredSubcats . length > 0 ) {
You can’t perform that action at this time.
0 commit comments