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: Incremental Static Build #47

Merged
merged 4 commits into from
May 16, 2022
Merged

feat: Incremental Static Build #47

merged 4 commits into from
May 16, 2022

Conversation

tlgimenes
Copy link
Contributor

@tlgimenes tlgimenes commented May 16, 2022

What's the purpose of this pull request?

This PR uses the new WebOps capability called Incremental Static Builds. This should drastically improve response times and reduce infrastructure usage on deferred pages, like PDPs and PLPs

How does it work?

WebOps recently released this Incremental Static Builds feature. To use on Gatsby, make sure to return the following cache-control headers on SSR pages:

'cache-control': 's-maxage=31536000, stale-while-revalidate',

and enable USE_STALE_CACHE=true on vtex.env.

How to test it?

Open a PDP. Check the response header called x-faststore-cache. The first request should give you a MISS. The second request should give you HIT. Note that HITs are much faster than MISS. Also, note that all subsequent requests have a HIT as value.

References

@vercel
Copy link

vercel bot commented May 16, 2022

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

Name Status Preview Updated
gatsby-store-storybook ❌ Failed (Inspect) May 16, 2022 at 4:42PM (UTC)

@vtex-sites
Copy link

vtex-sites bot commented May 16, 2022

Preview is ready

This pull request generated a Preview

👀   Preview: https://preview-47--gatsby.preview.vtex.app
🔬   Go deeper by inspecting the Build Logs
📝   based on commit 33138df

@vtex-sites
Copy link

vtex-sites bot commented May 16, 2022

Lighthouse Reports

Here are the Lighthouse reports of this Pull Request

📝 Based on commit 33138df

Lighthouse Report by page
📎   /
📎   /apple-magic-mouse-99988212/p
📎   /office

@tlgimenes tlgimenes changed the title feat: Incremental Builds feat: Incremental Static Build May 16, 2022
Copy link
Contributor

@igorbrasileiro igorbrasileiro left a comment

Choose a reason for hiding this comment

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

Great job, my tip, create a constant called max_age with the 2 year value. It will enhance the readability

Copy link
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

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

Looks good!
I tried to simulate but got MISS on every refresh.

src/pages/[...slug].tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@filipewl filipewl left a comment

Choose a reason for hiding this comment

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

Awesome!
CleanShot 2022-05-16 at 12 54 56

Copy link
Member

@eduardoformiga eduardoformiga left a comment

Choose a reason for hiding this comment

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

LGTM! I was testing in the wrong request.
It works as expected 🎉

@tlgimenes tlgimenes merged commit 33138df into main May 16, 2022
@tlgimenes tlgimenes deleted the feat/swr branch May 16, 2022 18:04
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.

5 participants