-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Add handling for redirects from getStaticProps/getServerSideProps #16642
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 12.8s | 12.5s | -316ms |
nodeModulesSize | 57.5 MB | 57.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.469 | 2.395 | -0.07 |
/ avg req/sec | 1012.39 | 1043.91 | +31.52 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.415 | 1.413 | 0 |
/error-in-render avg req/sec | 1767.11 | 1769.36 | +2.25 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | 10.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-ce79c9a..12c9.js gzip | 7.36 kB | 7.36 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | 6.23 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-9973c26..dule.js gzip | 6.42 kB | 6.42 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.3 kB | 52.4 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 972 B | 971 B | -1 B |
link.html gzip | 978 B | 977 B | -1 B |
withRouter.html gzip | 964 B | 963 B | -1 B |
Overall change | 2.91 kB | 2.91 kB | -3 B |
Diffs
Diff for 677f882d2ed8..60.module.js
@@ -1041,7 +1041,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for 677f882d2ed8..886051899.js
@@ -1117,6 +1117,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
missingParams,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1297,14 +1302,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1316,9 +1374,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1329,28 +1387,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1358,7 +1416,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 13.9s | 14.1s | |
nodeModulesSize | 57.5 MB | 57.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-ce79c9a..12c9.js gzip | 7.36 kB | 7.36 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..df1d.js gzip | N/A | 10.4 kB | N/A |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-9973c26..dule.js gzip | 6.42 kB | 6.42 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.23 kB | N/A |
Overall change | 52.3 kB | 52.4 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.07 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.28 MB | 5.29 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 13.1s | 13.8s | |
nodeModulesSize | 57.5 MB | 57.5 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.66 | 2.647 | -0.01 |
/ avg req/sec | 939.8 | 944.49 | +4.69 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.665 | 1.691 | |
/error-in-render avg req/sec | 1501.62 | 1478.75 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | 10.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-ce79c9a..12c9.js gzip | 7.36 kB | 7.36 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | 6.23 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-9973c26..dule.js gzip | 6.42 kB | 6.42 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.3 kB | 52.4 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 972 B | 971 B | -1 B |
link.html gzip | 978 B | 977 B | -1 B |
withRouter.html gzip | 964 B | 963 B | -1 B |
Overall change | 2.91 kB | 2.91 kB | -3 B |
Diffs
Diff for 677f882d2ed8..60.module.js
@@ -1041,7 +1041,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for 677f882d2ed8..886051899.js
@@ -1117,6 +1117,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
missingParams,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1297,14 +1302,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1316,9 +1374,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1329,28 +1387,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1358,7 +1416,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 15.6s | 15.7s | |
nodeModulesSize | 57.5 MB | 57.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-ce79c9a..12c9.js gzip | 7.36 kB | 7.36 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..df1d.js gzip | N/A | 10.4 kB | N/A |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-9973c26..dule.js gzip | 6.42 kB | 6.42 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.23 kB | N/A |
Overall change | 52.3 kB | 52.4 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.07 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.28 MB | 5.29 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 13.3s | 13.8s | |
nodeModulesSize | 57.4 MB | 57.4 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.402 | 2.541 | |
/ avg req/sec | 1040.99 | 983.94 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.519 | 1.613 | |
/error-in-render avg req/sec | 1645.38 | 1549.73 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | 10.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-49b1fd5..c64c.js gzip | 7.35 kB | 7.35 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | 6.23 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-99715b4..dule.js gzip | 6.4 kB | 6.4 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.2 kB | 52.3 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 971 B | 971 B | ✓ |
link.html gzip | 977 B | 979 B | |
withRouter.html gzip | 964 B | 964 B | ✓ |
Overall change | 2.91 kB | 2.91 kB |
Diffs
Diff for 677f882d2ed8..60.module.js
@@ -1041,7 +1041,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for 677f882d2ed8..886051899.js
@@ -1117,6 +1117,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
missingParams,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1297,14 +1302,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1316,9 +1374,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1329,28 +1387,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1358,7 +1416,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 14.9s | 15.7s | |
nodeModulesSize | 57.4 MB | 57.4 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-49b1fd5..c64c.js gzip | 7.35 kB | 7.35 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..df1d.js gzip | N/A | 10.4 kB | N/A |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-99715b4..dule.js gzip | 6.4 kB | 6.4 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.23 kB | N/A |
Overall change | 52.2 kB | 52.3 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.07 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.28 MB | 5.29 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 13.5s | 13.4s | -88ms |
nodeModulesSize | 56.8 MB | 56.8 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.511 | 2.517 | |
/ avg req/sec | 995.46 | 993.27 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.518 | 1.487 | -0.03 |
/error-in-render avg req/sec | 1646.58 | 1681.7 | +35.12 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | 10.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-49b1fd5..c64c.js gzip | 7.35 kB | 7.35 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | 6.23 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-99715b4..dule.js gzip | 6.4 kB | 6.4 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.2 kB | 52.3 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 971 B | 971 B | ✓ |
link.html gzip | 977 B | 979 B | |
withRouter.html gzip | 964 B | 964 B | ✓ |
Overall change | 2.91 kB | 2.91 kB |
Diffs
Diff for 677f882d2ed8..60.module.js
@@ -1041,7 +1041,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for 677f882d2ed8..886051899.js
@@ -1117,6 +1117,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
missingParams,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1297,14 +1302,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1316,9 +1374,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1329,28 +1387,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1358,7 +1416,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b1af6078fa6886051899.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.8bbd9ad3a3297b42720e.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2206d208af7e83206260.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f413b69528f6d7b79516.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 15.4s | 15.4s | -6ms |
nodeModulesSize | 56.8 MB | 56.8 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..f20b.js gzip | 10.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-49b1fd5..c64c.js gzip | 7.35 kB | 7.35 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..df1d.js gzip | N/A | 10.4 kB | N/A |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-99715b4..dule.js gzip | 6.4 kB | 6.4 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.23 kB | N/A |
Overall change | 52.2 kB | 52.3 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-28298..e0c9.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-000f151..65d4.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-65c8a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-4cfda7a..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 330 B | 330 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.07 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.28 MB | 5.29 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 13.4s | 13s | -428ms |
nodeModulesSize | 55.9 MB | 55.9 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.504 | 2.545 | |
/ avg req/sec | 998.59 | 982.16 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.504 | 1.57 | |
/error-in-render avg req/sec | 1662.25 | 1592.34 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..9ff9.js gzip | 10.3 kB | 10.4 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-2db3d72..5955.js gzip | 7.35 kB | 7.35 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | 6.23 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-d7fe688..dule.js gzip | 6.41 kB | 6.41 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.3 kB | 52.4 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-ae98065..267e.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-cb244c4..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 971 B | 972 B | |
link.html gzip | 976 B | 977 B | |
withRouter.html gzip | 964 B | 965 B | |
Overall change | 2.91 kB | 2.91 kB |
Diffs
Diff for 677f882d2ed8..7000fca82.js
@@ -1117,6 +1117,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
missingParams,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1297,14 +1302,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1316,9 +1374,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1329,28 +1387,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1358,7 +1416,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for 677f882d2ed8..87.module.js
@@ -1041,7 +1041,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f48d291f6d1033f6c087.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.da7351d0ca3e06e03725.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.abb28f9c6d97000fca82.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b3b0a71d74c5ce213350.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f48d291f6d1033f6c087.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.da7351d0ca3e06e03725.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f48d291f6d1033f6c087.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.da7351d0ca3e06e03725.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.abb28f9c6d97000fca82.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b3b0a71d74c5ce213350.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f48d291f6d1033f6c087.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.da7351d0ca3e06e03725.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f48d291f6d1033f6c087.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.da7351d0ca3e06e03725.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.abb28f9c6d97000fca82.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b3b0a71d74c5ce213350.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f48d291f6d1033f6c087.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.da7351d0ca3e06e03725.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 15.2s | 15.4s | |
nodeModulesSize | 55.9 MB | 55.9 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..9ff9.js gzip | 10.3 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-2db3d72..5955.js gzip | 7.35 kB | 7.35 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..2666.js gzip | N/A | 10.4 kB | N/A |
Overall change | 57.3 kB | 57.5 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-d7fe688..dule.js gzip | 6.41 kB | 6.41 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.23 kB | N/A |
Overall change | 52.3 kB | 52.4 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-ae98065..267e.js gzip | 1.29 kB | 1.29 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.69 kB | 7.69 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-cb244c4..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.35 kB | 5.35 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 652 B | 652 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.07 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.28 MB | 5.29 MB |
packages/next/types/index.d.ts
Outdated
@@ -80,6 +85,7 @@ export type GetStaticPropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery> = { | |||
|
|||
export type GetStaticPropsResult<P> = { | |||
props: P | |||
unstable_redirect?: Redirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type is incorrect, you can either return unstable_redirect
or props
, not both
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the comment
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 12.4s | 12.7s | |
nodeModulesSize | 56.7 MB | 56.7 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.247 | 2.206 | -0.04 |
/ avg req/sec | 1112.75 | 1133.36 | +20.61 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.22 | 1.201 | -0.02 |
/error-in-render avg req/sec | 2048.9 | 2082.38 | +33.48 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..7362.js gzip | 10.6 kB | 10.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-979126c..02f7.js gzip | 7.08 kB | 7.08 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.4 kB | 57.6 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.51 kB | 6.62 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-e37c8f7..dule.js gzip | 6.14 kB | 6.14 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.4 kB | 52.5 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-d2344ce..8b36.js gzip | 1.3 kB | 1.3 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.71 kB | 7.71 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-f8c0daf..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 651 B | 651 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 973 B | 972 B | -1 B |
link.html gzip | 979 B | 979 B | ✓ |
withRouter.html gzip | 966 B | 965 B | -1 B |
Overall change | 2.92 kB | 2.92 kB | -2 B |
Diffs
Diff for 677f882d2ed8..2db076a1e.js
@@ -1214,6 +1214,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
params,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1406,14 +1411,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1425,9 +1483,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1438,28 +1496,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1467,7 +1525,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for 677f882d2ed8..7e.module.js
@@ -1136,7 +1136,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.48509355e812db076a1e.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3708ec5b82fc3c4f674d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.48509355e812db076a1e.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3708ec5b82fc3c4f674d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.48509355e812db076a1e.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3708ec5b82fc3c4f674d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 14.4s | 14s | -410ms |
nodeModulesSize | 56.7 MB | 56.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..7362.js gzip | 10.6 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-979126c..02f7.js gzip | 7.08 kB | 7.08 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..a2cc.js gzip | N/A | 10.8 kB | N/A |
Overall change | 57.4 kB | 57.6 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.51 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-e37c8f7..dule.js gzip | 6.14 kB | 6.14 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.62 kB | N/A |
Overall change | 52.4 kB | 52.5 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-d2344ce..8b36.js gzip | 1.3 kB | 1.3 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.71 kB | 7.71 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-f8c0daf..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 651 B | 651 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.08 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.29 MB | 5.3 MB |
Failing test suitesCommit: 461c52a test/integration/build-output/test/index.test.js
Expand output● Build Output › Basic Application Output › should not deviate from snapshot
test/integration/size-limit/test/index.test.js
Expand output● Production response size › should not increase the overall response size of default build
|
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.8s | |
nodeModulesSize | 56.7 MB | 56.7 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.061 | 2.093 | |
/ avg req/sec | 1212.89 | 1194.17 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.1 | 1.14 | |
/error-in-render avg req/sec | 2272.11 | 2193.51 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..7362.js gzip | 10.6 kB | 10.8 kB | |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-979126c..02f7.js gzip | 7.08 kB | 7.08 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 57.4 kB | 57.6 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.51 kB | 6.62 kB | |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-e37c8f7..dule.js gzip | 6.14 kB | 6.14 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 52.4 kB | 52.5 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-d2344ce..8b36.js gzip | 1.3 kB | 1.3 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.71 kB | 7.71 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-f8c0daf..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 651 B | 651 B | ✓ |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
index.html gzip | 973 B | 972 B | -1 B |
link.html gzip | 979 B | 979 B | ✓ |
withRouter.html gzip | 966 B | 965 B | -1 B |
Overall change | 2.92 kB | 2.92 kB | -2 B |
Diffs
Diff for 677f882d2ed8..2db076a1e.js
@@ -1214,6 +1214,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
params,
routeInfo,
error,
+ props,
+ __N_SSG,
+ __N_SSP,
+ destination,
+ parsedHref,
appComp;
return _regeneratorRuntime.wrap(
@@ -1406,14 +1411,67 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
case 51:
routeInfo = _context.sent;
- error = routeInfo.error;
+ (error = routeInfo.error),
+ (props = routeInfo.props),
+ (__N_SSG = routeInfo.__N_SSG),
+ (__N_SSP = routeInfo.__N_SSP); // handle redirect on client-transition
+
+ if (
+ !(
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ )
+ ) {
+ _context.next = 62;
+ break;
+ }
+
+ destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (!destination.startsWith("/")) {
+ _context.next = 60;
+ break;
+ }
+
+ parsedHref = (0,
+ _parseRelativeUrl.parseRelativeUrl)(destination);
+
+ this._resolveHref(parsedHref, pages);
+
+ if (!pages.includes(parsedHref.pathname)) {
+ _context.next = 60;
+ break;
+ }
+
+ return _context.abrupt(
+ "return",
+ this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ )
+ );
+
+ case 60:
+ window.location.href = destination;
+ return _context.abrupt(
+ "return",
+ new Promise(function() {})
+ );
+
+ case 62:
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
if (false) {
}
- _context.next = 58;
+ _context.next = 67;
return this.set(
route,
pathname,
@@ -1425,9 +1483,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
else throw e;
});
- case 58:
+ case 67:
if (!error) {
- _context.next = 61;
+ _context.next = 70;
break;
}
@@ -1438,28 +1496,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 61:
+ case 70:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 66:
- _context.prev = 66;
+ case 75:
+ _context.prev = 75;
_context.t0 = _context["catch"](48);
if (!_context.t0.cancelled) {
- _context.next = 70;
+ _context.next = 79;
break;
}
return _context.abrupt("return", false);
- case 70:
+ case 79:
throw _context.t0;
- case 71:
+ case 80:
case "end":
return _context.stop();
}
@@ -1467,7 +1525,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[48, 66]]
+ [[48, 75]]
);
})
);
Diff for 677f882d2ed8..7e.module.js
@@ -1136,7 +1136,39 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
as,
shallow
);
- var { error } = routeInfo;
+ var { error, props, __N_SSG, __N_SSP } = routeInfo; // handle redirect on client-transition
+
+ if (
+ (__N_SSG || __N_SSP) &&
+ props &&
+ props.pageProps &&
+ props.pageProps.__N_REDIRECT
+ ) {
+ var destination = props.pageProps.__N_REDIRECT; // check if destination is internal (resolves to a page) and attempt
+ // client-navigation if it is falling back to hard navigation if
+ // it's not
+
+ if (destination.startsWith("/")) {
+ var parsedHref = (0, _parseRelativeUrl.parseRelativeUrl)(
+ destination
+ );
+
+ this._resolveHref(parsedHref, pages);
+
+ if (pages.includes(parsedHref.pathname)) {
+ return this.change(
+ "replaceState",
+ destination,
+ destination,
+ options
+ );
+ }
+ }
+
+ window.location.href = destination;
+ return new Promise(() => {});
+ }
+
Router.events.emit("beforeHistoryChange", as);
this.changeState(method, url, as, options);
Diff for index.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.48509355e812db076a1e.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3708ec5b82fc3c4f674d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -123,13 +123,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.48509355e812db076a1e.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3708ec5b82fc3c4f674d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -25,7 +25,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -118,13 +118,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.48509355e812db076a1e.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.3708ec5b82fc3c4f674d.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e1be7d91975a4e7aea7e.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7d132ab979d135defe45.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
buildDuration | 13.7s | 13.3s | -317ms |
nodeModulesSize | 56.7 MB | 56.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..7362.js gzip | 10.6 kB | N/A | N/A |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-979126c..02f7.js gzip | 7.08 kB | 7.08 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..a2cc.js gzip | N/A | 10.8 kB | N/A |
Overall change | 57.4 kB | 57.6 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.51 kB | N/A | N/A |
framework.HA..dule.js gzip | 39 kB | 39 kB | ✓ |
main-e37c8f7..dule.js gzip | 6.14 kB | 6.14 kB | ✓ |
webpack-07c5..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.62 kB | N/A |
Overall change | 52.4 kB | 52.5 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-9a0b9e1..b37e.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-ed1b0..8fbd.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-89731c..c609.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-d2344ce..8b36.js gzip | 1.3 kB | 1.3 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 7.71 kB | 7.71 kB | ✓ |
Client Pages Modern
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_app-75d3a82..dule.js gzip | 625 B | 625 B | ✓ |
_error-4469a..dule.js gzip | 2.29 kB | 2.29 kB | ✓ |
hooks-cbf13f..dule.js gzip | 387 B | 387 B | ✓ |
index-b9a643..dule.js gzip | 226 B | 226 B | ✓ |
link-f8c0daf..dule.js gzip | 1.26 kB | 1.26 kB | ✓ |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-f..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
_buildManife..dule.js gzip | 329 B | 329 B | ✓ |
Overall change | 651 B | 651 B | ✓ |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | ijjk/next.js add/gssp-redirect-handling | Change | |
---|---|---|---|
_error.js | 1.03 MB | 1.03 MB | |
404.html | 4.22 kB | 4.22 kB | ✓ |
hooks.html | 3.86 kB | 3.86 kB | ✓ |
index.js | 1.03 MB | 1.03 MB | |
link.js | 1.08 MB | 1.08 MB | |
routerDirect.js | 1.07 MB | 1.07 MB | |
withRouter.js | 1.07 MB | 1.07 MB | |
Overall change | 5.29 MB | 5.3 MB |
Can I use it for redirect with status 404 in getStaticProps/SSG?
|
…rcel#16642) Co-authored-by: Tim Neutkens <timneutkens@me.com>
This implements the RFC posted here #14890
Closes: #16587