Skip to content

Commit ffc26c3

Browse files
(fix/site-2563): configurando o loader para nao remover mais o notfound na consulta do inteligentsearch
1 parent 6fab893 commit ffc26c3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

vtex/loaders/intelligentSearch/productListingPage.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ const selectPriceFacet = (facets: Facet[], selectedFacets: SelectedFacet[]) => {
291291
}
292292
return facets;
293293
};
294+
295+
const hasInvalidCategorySegment = (allPageTypes: PageType[]): boolean => {
296+
return allPageTypes.some((pageType) => pageType.pageType === "NotFound");
297+
};
298+
294299
/**
295300
* @title Product Listing Page - Intelligent Search
296301
* @description List a product listing page, with products, filters, sort and SEO data, commonly used for category, search, brand and collection pages.
@@ -334,6 +339,12 @@ const loader = async (
334339
}
335340

336341
const allPageTypes = await pageTypesFromUrl(pathToUse, ctx);
342+
343+
if (hasInvalidCategorySegment(allPageTypes)) {
344+
345+
return null;
346+
}
347+
337348
const pageTypes = getValidTypesFromPageTypes(allPageTypes);
338349

339350
const selectedFacets = baseSelectedFacets.length === 0

0 commit comments

Comments
 (0)