Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow category tree filters on vtex legacy filters #56

Conversation

jovenan
Copy link
Contributor

@jovenan jovenan commented Sep 16, 2023

Feature description:
This PR Allows the category tree filters to Vtex Legacy ProductListingPage. By sending to front the categories below the current department or category.

Use case:
https://www.austral.com.br/masculino?O=OrderByScoreDESC
https://australroupas.deco.site/masculino?O=OrderByScoreDESC

@jovenan
Copy link
Contributor Author

jovenan commented Sep 16, 2023

This PR is the same of the STD PR: deco-sites/std#179 however without correcting the URL that returns the same page as this feature has already been corrected


// Get categories of the current department/category
const getCategoryFacets = (CategoriesTrees: LegacyFacet[]): LegacyFacet[] => {
const isDepartmentOrCategoryPage = !pageType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this condition accurate?

Copy link
Contributor Author

@jovenan jovenan Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, because if the page is not a departament or category, an error will occur. For example if the page is a search page, the pageType const will be undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@tlgimenes tlgimenes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed feelings about this one. The loader should "load" the data and it's up to the react component to filter it and render it. This implementation makes it impossible for someone to render other categories because the loader is filtering the data.

I'll accept since this loader may be deprecated in the future, but a nit would be to return all data an filter it on the frontend

@tlgimenes tlgimenes merged commit f6360a5 into deco-cx:main Sep 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants