<aside> 🧠 This guide uses the Performance Insights feature of Google Chrome development tools. Refer to this guide to learn how to use it!

How to get FCP and LCP readings?

</aside>

The critical rendering path, is a path that browser needs to take in order to display an LCP element. This includes rendering parent components and requesting chunks where these components are located. For example, to render the gallery image on PDP (which is considered an LCP element), the browser might need to:

  1. Request main chunk

  2. Render App component

  3. Render Router component

  4. Request url-rewrites chunk

  5. Render UrlRewrites component

  6. Request product chunk

  7. Render ProductPage component

  8. Render ProductGallery component

  9. Render ProductImage component

  10. Render Image component

  11. Request LCP image

To learn such critical path for LCP element of interest, the following steps need to be taken:

1. Measure the LCP

On the right of the timeline, there is a section containing two tabs: Insights and Details.

To read more information about LCP event, select Insights tab, then scroll it, until you see Largest Contentful Paint event appear.

Click it!

Untitled

2. Find the LCP element

Lookup the LCP Element collapsible element, expand it. Find the Element entry, and click on the blue code icon near it.

This should highlight the element in the Elements tab, and add a blue overlay to it on the website.

Untitled

3. Run the application in development mode

To find where was this element rendered, you will need to:

  1. Install React development tools extension

  2. Run your application in development mode (in production ScandiPWA prohibits React development tools to work). From ScandiPWA root, run:

    yarn start # using Yarn
    npm run start # using NPM
    

Untitled

4. Find the LCP element location in code / React tree

With application started in the development mode, open it in the browser and head to ⚛️ Components tab.

Using the element inspector (from React development tools), select the element seen in the previous step. This should highlight in the React components tree.

Note components that were required to render the element. In our case:

  1. Entry-point
  2. App
  3. Router
  4. Homepage
  5. CmsPage
  6. Html
  7. Slider
  8. HeroBanner

Untitled

5. Learn which chunks are components defined in

Select the element, location of which you would like to learn. Click on the < > symbol, this will take you to the chunk, where this component is declared.

Untitled