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: new RenderSections for all pages #2558

Open
wants to merge 19 commits into
base: feat/SFS-1511-split-home-section-own-file-again
Choose a base branch
from

Conversation

eduardoformiga
Copy link
Member

@eduardoformiga eduardoformiga commented Nov 12, 2024

Depends on

What's the purpose of this pull request?

This PR is part of the performance initiative.

It aims to create a new structure for the RenderSections that uses the ViewportObserver along with the LazyLoadingSection to load the section on demand. Now, the RenderSections receives the globalSection as props, and we are removing the GlobalSection (parent) Component that wraps the pages.

It also applies this structure to all pages:

  • home
  • pdp
  • plp
  • login
  • checkout
  • account
  • search
  • landing page
  • 500
  • 404

PS: some changes from PLP and Landing Page need to be applied now. Then I applied some Promise.all and other improvements beforehand.

How to test it?

Now, we can only load the JS for the sections inside the viewport during the first load. You can check the network tab in devtools while scrolling the page until the Footer to double-check the JS for sections above the fold being loaded.

You can run the project locally or use the starter preview to double-check this behavior.

you can test all the pages. The landing page can be accessed through this URL:
http://localhost:3000/my-landing-page

Screen.Recording.2024-11-12.at.19.27.16.mov

Performance

Before After
https://starter.vtex.app/ https://sfj-b662675--starter.preview.vtex.app/
on a lucky day (when PSI has a good sense of humor, haha) Screenshot 2024-11-12 at 19 49 50 Screenshot 2024-11-12 at 19 50 00
on a normal day Screenshot 2024-11-12 at 19 54 24 Screenshot 2024-11-12 at 19 54 17

Starters Deploy Preview

preview
https://sfj-b662675--starter.preview.vtex.app/

References

In this video, you can see an explanation of loading JS on demand using the Intersection Observer API + code splitting.
https://drive.google.com/file/u/1/d/13VYPu45Vaav2ecGmKcFAOUMKAS3pMHd4/view

POC PR

Copy link

vercel bot commented Nov 12, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
faststore-site ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 10:02pm

Copy link

codesandbox-ci bot commented Nov 12, 2024

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 Nov 12, 2024
@eduardoformiga eduardoformiga marked this pull request as ready for review November 12, 2024 22:24
@eduardoformiga eduardoformiga requested a review from a team as a code owner November 12, 2024 22:24
@eduardoformiga eduardoformiga requested review from emersonlaurentino and lariciamota and removed request for a team November 12, 2024 22:24
@eduardoformiga eduardoformiga added the depends on Depends on another PR - Please mention the PR label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends on Depends on another PR - Please mention the PR performance Pull requests related to perfomance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant