-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Current behavior
These are the default included fields for ElasticSearch category queries, as defined in the default.config file:
"includeFields": [ "id", "*.children_data.id", "*.id", "children_count", "sku", "name", "is_active", "parent_id", "level", "url_key", "url_path", "product_count", "path", "position"]
According to these fields, only the id field of each category's children_data should be loaded.
In my project I needed to implement a desktop menu which required more information in children_data, namely children_data.name and children_data.url_path.
I extended includeFields to [ "id", "children_data.id", "children_data.name", "children_data.url_path" ,"*.children_data.id", "*.children_data.name", "*.children_data.url_path", "*.id", "children_count", "sku", "name", "is_active", "parent_id", "level", "url_key", "url_path", "product_count", "path", "position"].
ElasticSearch now provided the extra fields, but the root categories suddenly disappeared in Vue Storefront. After digging through the code, I found the problem to be in the CATEGORY_UPD_CATEGORIES mutation.
When the new categories are retrieved from ElasticSearch, there is a loop going through children_data and creating slug fields recursively if the children_data.name field exists.
Responsible line: https://github.com/DivanteLtd/vue-storefront/blob/master/core/modules/catalog/store/category/mutations.ts#L25
This problem only exists in v1.11.0+. I switched to the old slug creation code and it works. So that's where the bug is.
Old slug creation code: https://github.com/DivanteLtd/vue-storefront/blob/hotfix/v1.10.6/core/modules/catalog/store/category/mutations.ts#L21
Expected behavior
Steps to reproduce the issue
Repository
Can you handle fixing this bug by yourself?
- YES
- NO
Which Release Cycle state this refers to? Info for developer.
Pick one option.
- This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from
developbranch and create Pull Request2. Feature / Improvementback todevelop. - This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from
releasebranch and create Pull Request3. Stabilisation fixback torelease. - This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from
hotfixormasterbranch and create Pull Request4. Hotfixback tohotfix.
Environment details
- Browser:
- OS:
- Node:
- Code Version: