feat(medusa) allow querying category descendants with a param in list endpoint (#3321)

What:

Allowing the list endpoint to return a full tree when requested. 

Why:

When scoped with parent_category_id=null and include_descendant_tree=true, the query cost is fairly low. This allows for fast querying and prevent FE from building out the entire tree from a flat list repeatedly. By default, it is set to false, so this should be an intentional change knowing the costs of doing it for the entire result set. 

How:

When include_descendants_tree is included in the request parameter or the service parameter, we do a loop on results of product categories and do a call to fetch the descendants of that product category. 

RESOLVES CORE-1128
This commit is contained in:
Riqwan Thamir authored and GitHub committed 2023-02-24 08:46:52 +00:00
1 parent ad7f56506f
commit 6323868f65
6 files changed
+102 -11

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
feat(medusa): allow appending all category descendants with a param in list endpoint