You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Display a loader (we could use a skeleton too) when this happens, so that the user doesn't face a white page until the page is generated and displayed
58
+
if(isSSGFallbackInitialBuild&&router.isFallback){// When router.isFallback becomes "false", then it'll mean the page has been generated and rendered and we can display it, instead of the loader
title: `Album N°${albumId} (SSG, ${hasUsedFallbackRendering ? 'using fallback' : 'not using fallback'}) - Next Right Now`,
125
+
title: `Album N°${albumId} (SSG, ${isSSGFallbackInitialBuild ? 'using fallback' : 'not using fallback'}) - Next Right Now`,
127
126
}}
128
127
>
128
+
<h1>Example, using SSG with fallback option</h1>
129
+
129
130
<div>
130
131
<Alertcolor={'info'}tag={'div'}>
132
+
This page will always be rendered statically, but the static bundle may be built either when deploying the website (AKA "pre-built"), or on-demand.<br/>
133
+
<br/>
134
+
This example has been made such as the main page (at /1) is pre-built, while all other pages are built on-demand, dynamically.<br/>
135
+
Once the static page has been generated, it'll use the static version for all upcoming requests. Only the first user suffers from the waiting due to the build.<br/>
136
+
When the page hasn't been rendered before (no static build available), then we display the <code>Loader</code> component so that the user can see something is happening instead of a white page.<br/>
137
+
<br/>
138
+
131
139
{
132
-
hasUsedFallbackRendering ? (
140
+
isSSGFallbackInitialBuild ? (
133
141
<p>
134
142
This page <b>has</b> used fallback rendering (it <b>hadn't</b> been generated previously).
In order to simplify things, NRN sets the <code>isSSGFallbackInitialBuild</code> variable, available in all pages as props.
192
+
</Alert>
193
+
178
194
<Alertcolor={'warning'}>
179
195
In development mode, it is not possible to simulate <code>fallback</code> mode properly.<br/>
180
-
Each page refresh will completely refresh the page, any previous build will be ignored.
196
+
Each page refresh will completely refresh the page, any previous build will be ignored, and all page refresh will have <code>isSSGFallbackInitialBuild: true</code>.
Copy file name to clipboardexpand all lines: src/types/nextjs/MultiversalAppBootstrapPageProps.ts
+1
Original file line number
Diff line number
Diff line change
@@ -6,5 +6,6 @@ import { Theme } from '../data/Theme';
6
6
*/
7
7
exporttypeMultiversalAppBootstrapPageProps={
8
8
i18nextInstance: i18n;
9
+
isSSGFallbackInitialBuild: boolean;// When true, means the app is loading a SSG page, with fallback mode enabled, and this page hasn't been built before
0 commit comments