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

feat: Filter with next/dynamic and lazy import #2596

Merged
merged 6 commits into from
Dec 18, 2024

Conversation

eduardoformiga
Copy link
Member

@eduardoformiga eduardoformiga commented Dec 13, 2024

What's the purpose of this pull request?

This PR involves significant changes to the filter components within the ProductGallery and related files. The main goal is to refactor the filter functionality by removing the Filter component and replacing it with FilterDesktop and FilterSlider components. Additionally, dynamic imports are introduced to optimize loading.

Key changes include:

Refactoring Filter Components:

  • Removed the Filter component and its associated code from Filter.tsx.
  • Updated FilterDesktop.tsx to include the GraphQL fragment previously in Filter.tsx.
  • Added dynamic imports for Filter, FilterFacetBoolean, FilterFacetBooleanItem, FilterFacetRange, FilterFacets, and FilterSlider in FilterSlider.tsx.
  • Modified index.ts to export FilterDesktop and FilterSlider instead of the removed Filter component.

Dynamic Imports:

  • Replaced static imports with dynamic imports for ProductCard, EmptyGallery, FilterDesktop, and FilterSlider in DefaultComponents.ts.

How to test it?

You can use the preview URL from the starter PR and double check that some JS are just loaded after Open the Filter in the mobile version.

https://sfj-d705510--starter.preview.vtex.app/office

Screen.Recording.2024-12-13.at.16.53.38.mov

Starters Deploy Preview

Copy link

vercel bot commented Dec 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
faststore-site ⬜️ Ignored (Inspect) Visit Preview Dec 13, 2024 7:34pm

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@eduardoformiga eduardoformiga added the performance Pull requests related to perfomance issues label Dec 13, 2024
@eduardoformiga eduardoformiga marked this pull request as ready for review December 13, 2024 19:57
@eduardoformiga eduardoformiga requested a review from a team as a code owner December 13, 2024 19:57
@eduardoformiga eduardoformiga requested review from lariciamota and renatomaurovtex and removed request for a team December 13, 2024 19:57
@eduardoformiga eduardoformiga requested review from a team, renatamottam and lucasfp13 and removed request for renatomaurovtex, a team and renatamottam December 13, 2024 19:59
Copy link
Contributor

@lucasfp13 lucasfp13 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@pedromtec pedromtec left a comment

Choose a reason for hiding this comment

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

LGTM

@eduardoformiga eduardoformiga merged commit 73e5496 into main Dec 18, 2024
12 checks passed
@eduardoformiga eduardoformiga deleted the feat/SFS-1863-Filter-with-performance branch December 18, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Pull requests related to perfomance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants