-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Only prefetch Link if router is in context #19857
Conversation
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 10.3s | 10.3s | -10ms |
nodeModulesSize | 82.4 MB | 82.4 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.53 | 2.546 | |
/ avg req/sec | 988.12 | 981.9 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.416 | 1.363 | -0.05 |
/error-in-render avg req/sec | 1765.77 | 1834 | +68.23 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-f501b4a..c42e.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.27 kB | 8.27 kB | ✓ |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 321 B | -1 B |
Overall change | 322 B | 321 B | -1 B |
Rendered Page Sizes
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 621 B | 621 B | ✓ |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-bdd2cad07648acf22380.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-00f0f71a76f57326f2aa.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-aa22eb3ee024b433cd56.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for link-00f0f71..57326f2aa.js
@@ -85,6 +85,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var prefetched = {};
function prefetch(router, href, as, options) {
+ if (!router) return;
if (false) {
}
if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
Diff for link.html
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ href="/_next/static/chunks/pages/link-aa22eb3ee024b433cd56.js"
as="script"
/>
</head>
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ src="/_next/static/chunks/pages/link-aa22eb3ee024b433cd56.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 12.5s | 12.3s | -213ms |
nodeModulesSize | 82.4 MB | 82.4 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-f501b4a..c42e.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | N/A | N/A |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
link-a082e4c..7984.js gzip | N/A | 1.61 kB | N/A |
Overall change | 8.27 kB | 8.27 kB | ✓ |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 321 B | -1 B |
Overall change | 322 B | 321 B | -1 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | ✓ |
withRouter.js | 1.05 MB | 1.05 MB | ✓ |
Overall change | 5.16 MB | 5.16 MB |
packages/next/client/link.tsx
Outdated
@@ -40,6 +40,7 @@ function prefetch( | |||
as: string, | |||
options?: PrefetchOptions | |||
): void { | |||
if (!router) return | |||
if (typeof window === 'undefined') return |
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.
You can do something like this instead to save some bytes
if (typeof window === 'undefined') return | |
if (typeof window === 'undefined' || !router) return |
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.
This change needs an integration test
Hi @timneutkens, thanks for looking at this and for your feedback. I made the suggested change, however I'd need some help for the integration test. Can you please point me to the correct file, or an example to re-use? This patch changes no behavior for app/prod code, is only meant to allow test environments to mount |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 10.5s | 10.5s | |
nodeModulesSize | 82.5 MB | 82.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.651 | 2.674 | |
/ avg req/sec | 943.01 | 934.98 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.606 | 1.539 | -0.07 |
/error-in-render avg req/sec | 1556.54 | 1624.04 | +67.5 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-f501b4a..c42e.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
Overall change | 8.27 kB | 8.27 kB | ✓ |
Client Build Manifests
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
Overall change | 322 B | 322 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 621 B | 621 B | ✓ |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB | ✓ |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-bdd2cad07648acf22380.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-00f0f71a76f57326f2aa.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-47e9d30705009340f173.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for link-00f0f71..57326f2aa.js
@@ -85,8 +85,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var prefetched = {};
function prefetch(router, href, as, options) {
- if (false) {
- }
+ if (false || !router) return;
if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
Diff for link.html
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ href="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
as="script"
/>
</head>
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ src="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 12s | 12.3s | |
nodeModulesSize | 82.5 MB | 82.5 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-f501b4a..c42e.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | N/A | N/A |
routerDirect..924c.js gzip | 284 B | 284 B | ✓ |
withRouter-7..c13d.js gzip | 284 B | 284 B | ✓ |
link-2fe9ad9..b3b7.js gzip | N/A | 1.61 kB | N/A |
Overall change | 8.27 kB | 8.27 kB | ✓ |
Client Build Manifests
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 322 B | ✓ |
Overall change | 322 B | 322 B | ✓ |
Serverless bundles
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | ✓ |
routerDirect.js | 1.05 MB | 1.05 MB | ✓ |
withRouter.js | 1.05 MB | 1.05 MB | ✓ |
Overall change | 5.16 MB | 5.16 MB | ✓ |
Stats from current PRDefault Server Mode (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 9.9s | 9.7s | -139ms |
nodeModulesSize | 82.5 MB | 82.5 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.366 | 2.439 | |
/ avg req/sec | 1056.79 | 1024.84 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.235 | 1.255 | |
/error-in-render avg req/sec | 2024.48 | 1991.35 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3e8cb31..cddc.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..fd29.js gzip | 303 B | 303 B | ✓ |
withRouter-b..76ae.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.31 kB | 8.31 kB | ✓ |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 323 B | |
Overall change | 322 B | 323 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 620 B | 621 B | |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-bdd2cad07648acf22380.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-00f0f71a76f57326f2aa.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-47e9d30705009340f173.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-6f408582ce776dfa74d5.js"
],
Diff for link-00f0f71..57326f2aa.js
@@ -85,8 +85,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var prefetched = {};
function prefetch(router, href, as, options) {
- if (false) {
- }
+ if (false || !router) return;
if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
Diff for link.html
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ href="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
as="script"
/>
</head>
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ src="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 11.7s | 11.7s | -7ms |
nodeModulesSize | 82.5 MB | 82.5 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3e8cb31..cddc.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | N/A | N/A |
routerDirect..fd29.js gzip | 303 B | 303 B | ✓ |
withRouter-b..76ae.js gzip | 302 B | 302 B | ✓ |
link-2fe9ad9..b3b7.js gzip | N/A | 1.61 kB | N/A |
Overall change | 8.31 kB | 8.31 kB | ✓ |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 323 B | |
Overall change | 322 B | 323 B |
Serverless bundles
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | ✓ |
routerDirect.js | 1.05 MB | 1.05 MB | ✓ |
withRouter.js | 1.05 MB | 1.05 MB | ✓ |
Overall change | 5.16 MB | 5.16 MB | ✓ |
@timneutkens I don't know if this counts as an integration test ; it feels more like a unit test to me, but I couldn't find any example of chrome webdriver that does not launch the Next.js app. Please let me know if this works for you, or if I should move it to the unit test folder, or if I need to go in a completely different direction.
|
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 8.4s | 8.3s | -47ms |
nodeModulesSize | 82.5 MB | 82.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.001 | 2.01 | |
/ avg req/sec | 1249.27 | 1243.86 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.083 | 1.06 | -0.02 |
/error-in-render avg req/sec | 2308.43 | 2358.43 | +50 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3e8cb31..cddc.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..fd29.js gzip | 303 B | 303 B | ✓ |
withRouter-b..76ae.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.31 kB | 8.31 kB | ✓ |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 323 B | |
Overall change | 322 B | 323 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 614 B | 614 B | ✓ |
link.html gzip | 620 B | 621 B | |
withRouter.html gzip | 608 B | 608 B | ✓ |
Overall change | 1.84 kB | 1.84 kB |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-bdd2cad07648acf22380.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-00f0f71a76f57326f2aa.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-47e9d30705009340f173.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-6f408582ce776dfa74d5.js"
],
Diff for link-00f0f71..57326f2aa.js
@@ -85,8 +85,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var prefetched = {};
function prefetch(router, href, as, options) {
- if (false) {
- }
+ if (false || !router) return;
if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
Diff for link.html
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ href="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
as="script"
/>
</head>
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ src="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 9.7s | 10.1s | |
nodeModulesSize | 82.5 MB | 82.5 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..34b9.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-3e8cb31..cddc.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-e067..f178.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-4b..e242.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-7231d4b..5856.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-01375..90b6.js gzip | 3.69 kB | 3.69 kB | ✓ |
hooks-d4591d..e7c2.js gzip | 887 B | 887 B | ✓ |
index-17468f..5d83.js gzip | 227 B | 227 B | ✓ |
link-db223d9..dbd7.js gzip | 1.61 kB | N/A | N/A |
routerDirect..fd29.js gzip | 303 B | 303 B | ✓ |
withRouter-b..76ae.js gzip | 302 B | 302 B | ✓ |
link-2fe9ad9..b3b7.js gzip | N/A | 1.61 kB | N/A |
Overall change | 8.31 kB | 8.31 kB | ✓ |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 322 B | 323 B | |
Overall change | 322 B | 323 B |
Serverless bundles
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | ✓ |
routerDirect.js | 1.05 MB | 1.05 MB | ✓ |
withRouter.js | 1.05 MB | 1.05 MB | ✓ |
Overall change | 5.16 MB | 5.16 MB | ✓ |
@timneutkens Hi, sorry to insist ; any chance you could review this MR again please? Cheers |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 10.7s | 10.5s | -150ms |
nodeModulesSize | 82.6 MB | 82.6 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.19 | 2.186 | 0 |
/ avg req/sec | 1141.44 | 1143.87 | +2.43 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.421 | 1.368 | -0.05 |
/error-in-render avg req/sec | 1759.32 | 1827.44 | +68.12 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..5e70.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-72193d1..1356.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-95c2..e870.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-d3..23f6.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-0d19cb6..5497.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-85785..a9f3.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-42456f..0c06.js gzip | 887 B | 887 B | ✓ |
index-8081ce..e44f.js gzip | 227 B | 227 B | ✓ |
link-0ab9f83..fa00.js gzip | 1.61 kB | 1.61 kB | ✓ |
routerDirect..c3d8.js gzip | 303 B | 303 B | ✓ |
withRouter-0..a68e.js gzip | 302 B | 302 B | ✓ |
Overall change | 8.05 kB | 8.05 kB | ✓ |
Client Build Manifests
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
Overall change | 323 B | 323 B | ✓ |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
index.html gzip | 613 B | 613 B | ✓ |
link.html gzip | 618 B | 619 B | |
withRouter.html gzip | 607 B | 607 B | ✓ |
Overall change | 1.84 kB | 1.84 kB |
Diffs
Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-bdd2cad07648acf22380.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-00f0f71a76f57326f2aa.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-47e9d30705009340f173.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-6f408582ce776dfa74d5.js"
],
Diff for link-00f0f71..57326f2aa.js
@@ -85,8 +85,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var prefetched = {};
function prefetch(router, href, as, options) {
- if (false) {
- }
+ if (false || !router) return;
if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
Diff for link.html
@@ -32,7 +32,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ href="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
as="script"
/>
</head>
@@ -78,7 +78,7 @@
async=""
></script>
<script
- src="/_next/static/chunks/pages/link-00f0f71a76f57326f2aa.js"
+ src="/_next/static/chunks/pages/link-47e9d30705009340f173.js"
async=""
></script>
<script src="/_next/static/BUILD_ID/_buildManifest.js" async=""></script>
Serverless Mode
General Overall increase ⚠️
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
buildDuration | 12.7s | 12.7s | |
nodeModulesSize | 82.6 MB | 82.6 MB |
Client Bundles (main, webpack, commons)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
677f882d2ed8..5e70.js gzip | 12.8 kB | 12.8 kB | ✓ |
framework.HASH.js gzip | 39 kB | 39 kB | ✓ |
main-72193d1..1356.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-95c2..e870.js gzip | 751 B | 751 B | ✓ |
Overall change | 59 kB | 59 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
polyfills-d3..23f6.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_app-0d19cb6..5497.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-85785..a9f3.js gzip | 3.44 kB | 3.44 kB | ✓ |
hooks-42456f..0c06.js gzip | 887 B | 887 B | ✓ |
index-8081ce..e44f.js gzip | 227 B | 227 B | ✓ |
link-0ab9f83..fa00.js gzip | 1.61 kB | N/A | N/A |
routerDirect..c3d8.js gzip | 303 B | 303 B | ✓ |
withRouter-0..a68e.js gzip | 302 B | 302 B | ✓ |
link-87a9325..7837.js gzip | N/A | 1.61 kB | N/A |
Overall change | 8.05 kB | 8.05 kB | ✓ |
Client Build Manifests
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_buildManifest.js gzip | 323 B | 323 B | ✓ |
Overall change | 323 B | 323 B | ✓ |
Serverless bundles
vercel/next.js canary | damusnet/next.js patch-1 | Change | |
---|---|---|---|
_error.js | 1 MB | 1 MB | ✓ |
404.html | 2.67 kB | 2.67 kB | ✓ |
hooks.html | 1.92 kB | 1.92 kB | ✓ |
index.js | 1 MB | 1 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | ✓ |
routerDirect.js | 1.05 MB | 1.05 MB | ✓ |
withRouter.js | 1.05 MB | 1.05 MB | ✓ |
Overall change | 5.16 MB | 5.16 MB | ✓ |
Thanks! The test looks fine 👍 |
Fixes #16864
The
router
can be missing in a test environment when trying to render aLink
component. This PR bails out ofrouter.prefetch()
whenrouter
is missing.The alternative is for users to mock
next/link
or to mock therouter
and wrap their test components.Please let me know any feedback.