VTEX IS PLP: breadcrumb empty on category pages when selectedFacets are pre-configured
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- web-dev
Research direction
Start in src/loaders/intelligentSearch/productListingPage.ts and inspect how pageTypesFromPath, facets, and pageTypesToBreadcrumb are used. Reproduce the category PLP with pre-configured selectedFacets, then verify pageTypes resolves for the breadcrumb without overriding those facets. Done means breadcrumb.itemListElement contains the expected category entries and the existing facet behavior remains intact.
Written by the indexing model from the issue text.
Description
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
SearchResultblock with pre-set categoryselectedFacets(the standard CMS category-page shape). - Load the page.
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):
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.
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 2
- Avg merge
- 20h 12m
- Merged PRs (30d)
- 36
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from decocms/blocks
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
deco-migrate: routes geram siteName com P maiúsculo ('Portaldavinci-tanstack') — lookup CMS falha Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100