Package / version
@decocms/apps-vtex — confirmed on 7.34.3 and latest 7.34.4.
File: src/loaders/intelligentSearch/productListingPage.ts
Summary
On a category PLP whose CMS block pre-configures selectedFacets, the returned breadcrumb.itemListElement is always [], so no breadcrumb renders. The deco-cx/apps (Fresh) original resolves the breadcrumb for the same block config — this is a regression in the port.
Root cause
pageTypes is only populated inside a branch gated on facets.length === 0:
let pageTypes: PageType[] = [];
if (
facets.length === 0 && // <-- gate
!query &&
__pagePath && __pagePath !== "/" && __pagePath !== "/*" &&
isValidPLPPath(__pagePath)
) {
const allPageTypes = await pageTypesFromPath(__pagePath);
pageTypes = getValidPageTypes(allPageTypes);
facets = filtersFromPageTypes(pageTypes);
}
The breadcrumb is then built from pageTypes:
const breadcrumbItems = pageTypesToBreadcrumb(pageTypes);
return {
breadcrumb: { "@type": "BreadcrumbList", itemListElement: breadcrumbItems, numberOfItems: breadcrumbItems.length },
...
};
Category blocks pre-configure facets (e.g. [{key:"category-1",value:"joias"},{key:"category-2",value:"aneis"},{key:"category-3",value:"meia alianca"}]), so facets.length > 0, the branch is skipped, pageTypes = [], and the breadcrumb comes back empty.
Reproduction
- Configure a
SearchResult block with pre-set category selectedFacets (the standard CMS category-page shape).
- Load the page.
page.breadcrumb.itemListElement is [] → breadcrumb does not render.
Proposed fix
Decouple the pageTypes resolution (needed for the breadcrumb) from the facet derivation (which correctly must not override pre-configured facets):
let pageTypes: PageType[] = [];
if (
!query &&
__pagePath && __pagePath !== "/" && __pagePath !== "/*" &&
isValidPLPPath(__pagePath)
) {
const allPageTypes = await pageTypesFromPath(__pagePath);
pageTypes = getValidPageTypes(allPageTypes);
if (facets.length === 0) {
facets = filtersFromPageTypes(pageTypes); // only when the CMS block didn't set them
}
}
pageTypesFromPath is already memoized (cachedPageType), so the extra call on pre-configured category paths is cheap.
Current workaround (site-level)
We wrap the loader and re-fetch pageTypesFromPath post-hoc when breadcrumb.itemListElement is empty and all selectedFacets are category-N. Would happily delete it once the upstream fix ships.
Package / version
@decocms/apps-vtex— confirmed on 7.34.3 and latest 7.34.4.File:
src/loaders/intelligentSearch/productListingPage.tsSummary
On a category PLP whose CMS block pre-configures
selectedFacets, the returnedbreadcrumb.itemListElementis always[], so no breadcrumb renders. The deco-cx/apps (Fresh) original resolves the breadcrumb for the same block config — this is a regression in the port.Root cause
pageTypesis only populated inside a branch gated onfacets.length === 0:The breadcrumb is then built from
pageTypes:Category blocks pre-configure facets (e.g.
[{key:"category-1",value:"joias"},{key:"category-2",value:"aneis"},{key:"category-3",value:"meia alianca"}]), sofacets.length > 0, the branch is skipped,pageTypes = [], and the breadcrumb comes back empty.Reproduction
SearchResultblock with pre-set categoryselectedFacets(the standard CMS category-page shape).page.breadcrumb.itemListElementis[]→ breadcrumb does not render.Proposed fix
Decouple the pageTypes resolution (needed for the breadcrumb) from the facet derivation (which correctly must not override pre-configured facets):
pageTypesFromPathis already memoized (cachedPageType), so the extra call on pre-configured category paths is cheap.Current workaround (site-level)
We wrap the loader and re-fetch
pageTypesFromPathpost-hoc whenbreadcrumb.itemListElementis empty and allselectedFacetsarecategory-N. Would happily delete it once the upstream fix ships.