File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ export class CategoryService {
2929 id : category . id ,
3030 parent_id : category ?. parent_id ?. id || null ,
3131 display_name : category . display_name ,
32- slug : category . slug
32+ slug : category . slug ,
33+ mapping_key : category . mapping_key
3334 } ;
3435 } ) ;
3536
@@ -47,13 +48,20 @@ export class CategoryService {
4748 if ( ! parentCategory . children ) {
4849 parentCategory . children = [ ] ;
4950 }
50- parentCategory . children . push ( category ) ;
51+ const copyCategory = { ...category } ;
52+ delete copyCategory . parent_id ;
53+ parentCategory . children . push ( copyCategory ) ;
5154 }
55+ } else {
56+ delete category . parent_id ;
5257 }
53- delete category . parent_id ;
5458 } ) ;
5559
56- allCategories = parsedCategories . filter ( category => ! category . parent_id ) ;
60+ const finalCategories = parsedCategories . filter ( category => ! category . parent_id ) ;
61+
62+ console . log ( 'Setting category cache with' , finalCategories . length , 'categories' ) ;
63+
64+ allCategories = finalCategories ;
5765 }
5866
5967 // eslint-disable-next-line @typescript-eslint/no-explicit-any
You can’t perform that action at this time.
0 commit comments