File tree Expand file tree Collapse file tree
src/components/ReferenceDirectoryWithFilter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,18 +72,26 @@ 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 ( subcat . entry &&
82+ subcat . entry . data . title
83+ . toLowerCase ( )
84+ . includes ( searchKeyword . toLowerCase ( ) )
85+ ) {
86+ filteredEntries . push ( subcat . entry ) ;
87+ }
88+
8189 if ( filteredEntries . length > 0 ) {
8290 subAcc . push ( { ...subcat , entries : filteredEntries } ) ;
8391 }
8492 return subAcc ;
8593 } ,
86- [ ] as typeof category . subcats ,
94+ [ ] ,
8795 ) ;
8896
8997 if ( filteredSubcats . length > 0 ) {
You can’t perform that action at this time.
0 commit comments