question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduce a new `fallback: 'blocking'` ISG mode

See original GitHub issue

Feature request

Next.js should allow pages leveraging Incremental Static Generation (fallback: true in getStaticPaths) to opt-into a server-side rendering mode when an unknown path is encountered.

Currently, we serve a static HTML fallback that then loads the data client-side (via a fetch to the server).

While the static HTML fallback is generally considered to be better end-user UX and does not negatively affect SEO, it is incompatible with certain apps that rely on Facebook, Twitter, or other og:* crawlers that don’t support JavaScript.

Like fallback: true, after the unknown route successfully renders for the first time, it’s served as static HTML going forward and no longer will be a on-demand (blocking) render (SSR).

Describe the solution you’d like

Allow users to return fallback: 'blocking' from getStaticPaths, opting-out of the static HTML fallback.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:27
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Timercommented, Aug 10, 2020

If the app is being hosted on Vercel too, does the combination of revalidate: 1 and fallback: ‘blocking’ provide any advantage over using setting a cache control header with max-age: 1 and a really long stale-while-revalidate?

As far as I can tell, setting cache-control this way would let me get the same behavior with getInitialProps?

One advantage is what @timneutkens mentioned above: This feature it provider-agnostic and built-into Next.js, meaning it does not require a CDN to work.

The second difference is that you can prerender critical paths by returning them from paths: [...], this is not possible with getInitialProps. This feature is very important as it prevents new deployments from 500ing due to your database going down, etc.

3reactions
timneutkenscommented, Aug 7, 2020

If the app is being hosted on Vercel too, does the combination of revalidate: 1 and fallback: ‘blocking’ provide any advantage over using setting a cache control header with max-age: 1 and a really long stale-while-revalidate?

Yeah it’s a similar behavior, main difference is that it’s integrated with Next.js and you don’t have to know the exact cache-control header to set (which often goes wrong, e.g. forgetting to add stale-while-revalidate and such)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blocking Fallback for getStaticPaths–New Next.js 10 feature
Using fallback: 'blocking' makes the user wait 🥱 without any response while the page is being built and it's better to use fallback:...
Read more >
Incremental Static Regeneration - Data Fetching - Next.js
{ fallback: blocking } will server-render pages // on-demand if the path ... a revalidation won't be able to pull fresh data to...
Read more >
Incremental Static Regeneration with Next.js - LogRocket Blog
Next.js v9.5 introduced a new strategy called Incremental Static Regeneration ... Detecting fallback mode is as easy as using React Hooks.
Read more >
Deploying Windows 10 Application Control Policy
All WDAC policy changes should be deployed in audit mode before proceeding to enforcement. Carefully monitor events from devices where the ...
Read more >
Integrated Secure Gateway 2.3 - TechDocs - Broadcom Inc.
The ISG Admin Console, introduced with ISG 2.2.1.1 GA, has been updated with: • A new Dashboard screen that provides an overview of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found