Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace broken prop-types-exact package #15953

Merged
merged 7 commits into from
Aug 18, 2020

Conversation

Timer
Copy link
Member

@Timer Timer commented Aug 6, 2020

This PR replaces prop-types-exact (only used in this location) with manual property checking.

Right now, malformed properties sent to <Link> are silently handled and only emit a warning in the console.
This leads to confusing/unexpected errors because we try to read a value that is undefined.

To fix this, we'll now throw a proper error when <Link> is misused. This still isn't optimal, however, because we don't have a component stack trace we can give the user.
We're not going to be able to give the user actionable instructions until React 16.14 at a minimum.


Fixes #13951
Fixes #16107
Closes #13962

@ijjk ijjk added the type: next label Aug 6, 2020
@ijjk
Copy link
Member

ijjk commented Aug 6, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
buildDuration 11.6s 11.5s -76ms
nodeModulesSize 65.9 MB 65.9 MB -26.2 kB
Page Load Tests Overall increase ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
/ failed reqs 0 0
/ total time (seconds) 2.214 2.113 -0.1
/ avg req/sec 1129.12 1183.1 +53.98
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.301 1.326 ⚠️ +0.03
/error-in-render avg req/sec 1921.68 1885.66 ⚠️ -36.02
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..795d.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-c30ac70..0d39.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-61da9c7..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB 1.28 kB -9 B
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
Overall change 7.71 kB 7.7 kB -9 B
Client Pages Modern Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB 1.25 kB -8 B
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
Overall change 5.37 kB 5.36 kB -8 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
index.html gzip 946 B 946 B
link.html gzip 953 B 952 B -1 B
withRouter.html gzip 940 B 940 B
Overall change 2.84 kB 2.84 kB -1 B

Diffs

Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-0cca92002e9102a47f97.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
   ],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
   ],
   "/link": [
-    "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
+    "static\u002Fchunks\u002Fpages\u002Flink-5dea19cb0676c57a1294.module.js"
   ],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-39e0042..3f7d406ca.js
@@ -78,8 +78,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
       var _router = __webpack_require__("elyg");
 
-      var _utils = __webpack_require__("g/15");
-
       var _router2 = __webpack_require__("nOHt");
 
       var cachedObserver;
@@ -197,7 +195,12 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
       function Link(props) {
         if (false) {
-          var hasWarned;
+          var hasWarned,
+            optionalProps,
+            optionalPropsGuard,
+            requiredProps,
+            requiredPropsGuard,
+            createPropError;
         }
 
         var p = props.prefetch !== false;
@@ -309,10 +312,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         return _react["default"].cloneElement(child, childProps);
       }
 
-      if (false) {
-        var exact, PropTypes, warn;
-      }
-
       var _default = Link;
       exports["default"] = _default;
Diff for link-e9ad838..bb.module.js
@@ -74,8 +74,6 @@
 
       var _router = __webpack_require__("elyg");
 
-      var _utils = __webpack_require__("g/15");
-
       var _router2 = __webpack_require__("nOHt");
 
       var cachedObserver;
@@ -193,7 +191,11 @@
 
       function Link(props) {
         if (false) {
-          var hasWarned;
+          var hasWarned,
+            optionalProps,
+            optionalPropsGuard,
+            requiredProps,
+            requiredPropsGuard;
         }
 
         var p = props.prefetch !== false;
@@ -291,10 +293,6 @@
         return _react.default.cloneElement(child, childProps);
       }
 
-      if (false) {
-        var exact, PropTypes, warn;
-      }
-
       var _default = Link;
       exports.default = _default;
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      href="/_next/static/chunks/pages/link-5dea19cb0676c57a1294.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -146,13 +146,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
+      src="/_next/static/chunks/pages/link-0cca92002e9102a47f97.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      src="/_next/static/chunks/pages/link-5dea19cb0676c57a1294.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
buildDuration 13.1s 12.7s -370ms
nodeModulesSize 65.9 MB 65.9 MB -26.2 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..795d.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-c30ac70..0d39.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-61da9c7..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB N/A N/A
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
link-d405628..84bb.js gzip N/A 1.28 kB N/A
Overall change 7.71 kB 7.7 kB -9 B
Client Pages Modern Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB N/A N/A
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
link-6c23ec5..dule.js gzip N/A 1.25 kB N/A
Overall change 5.37 kB 5.36 kB -8 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Serverless bundles Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_error.js 1.03 MB 1.03 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.03 MB 1.03 MB
link.js 1.07 MB 1.07 MB -58 B
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.26 MB 5.26 MB -58 B
Commit: 4ffe16a

@ijjk
Copy link
Member

ijjk commented Aug 6, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
buildDuration 13.3s 13.2s -20ms
nodeModulesSize 65.9 MB 65.9 MB -26.2 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
/ failed reqs 0 0
/ total time (seconds) 2.468 2.428 -0.04
/ avg req/sec 1012.84 1029.75 +16.91
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.473 1.562 ⚠️ +0.09
/error-in-render avg req/sec 1697.71 1600.59 ⚠️ -97.12
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..795d.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-c30ac70..0d39.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-61da9c7..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB 1.28 kB -9 B
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
Overall change 7.71 kB 7.7 kB -9 B
Client Pages Modern Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB 1.25 kB -8 B
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
Overall change 5.37 kB 5.36 kB -8 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
index.html gzip 946 B 946 B
link.html gzip 953 B 952 B -1 B
withRouter.html gzip 940 B 940 B
Overall change 2.84 kB 2.84 kB -1 B

Diffs

Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-0cca92002e9102a47f97.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
   ],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
   ],
   "/link": [
-    "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
+    "static\u002Fchunks\u002Fpages\u002Flink-5dea19cb0676c57a1294.module.js"
   ],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-39e0042..3f7d406ca.js
@@ -78,8 +78,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
       var _router = __webpack_require__("elyg");
 
-      var _utils = __webpack_require__("g/15");
-
       var _router2 = __webpack_require__("nOHt");
 
       var cachedObserver;
@@ -197,7 +195,12 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
       function Link(props) {
         if (false) {
-          var hasWarned;
+          var hasWarned,
+            optionalProps,
+            optionalPropsGuard,
+            requiredProps,
+            requiredPropsGuard,
+            createPropError;
         }
 
         var p = props.prefetch !== false;
@@ -309,10 +312,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         return _react["default"].cloneElement(child, childProps);
       }
 
-      if (false) {
-        var exact, PropTypes, warn;
-      }
-
       var _default = Link;
       exports["default"] = _default;
Diff for link-e9ad838..bb.module.js
@@ -74,8 +74,6 @@
 
       var _router = __webpack_require__("elyg");
 
-      var _utils = __webpack_require__("g/15");
-
       var _router2 = __webpack_require__("nOHt");
 
       var cachedObserver;
@@ -193,7 +191,11 @@
 
       function Link(props) {
         if (false) {
-          var hasWarned;
+          var hasWarned,
+            optionalProps,
+            optionalPropsGuard,
+            requiredProps,
+            requiredPropsGuard;
         }
 
         var p = props.prefetch !== false;
@@ -291,10 +293,6 @@
         return _react.default.cloneElement(child, childProps);
       }
 
-      if (false) {
-        var exact, PropTypes, warn;
-      }
-
       var _default = Link;
       exports.default = _default;
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      href="/_next/static/chunks/pages/link-5dea19cb0676c57a1294.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -146,13 +146,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
+      src="/_next/static/chunks/pages/link-0cca92002e9102a47f97.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
+      src="/_next/static/chunks/pages/link-5dea19cb0676c57a1294.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
buildDuration 14.7s 14.3s -383ms
nodeModulesSize 65.9 MB 65.9 MB -26.2 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..795d.js gzip 9.99 kB 9.99 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
main-c30ac70..0d39.js gzip 6.74 kB 6.74 kB
webpack-ccf5..276a.js gzip 751 B 751 B
Overall change 56.6 kB 56.6 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..dule.js gzip 5.89 kB 5.89 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
main-61da9c7..dule.js gzip 5.81 kB 5.81 kB
webpack-10c7..dule.js gzip 751 B 751 B
Overall change 51.6 kB 51.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
polyfills-75..1629.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-874bd8a..0103.js gzip 1.28 kB 1.28 kB
_error-fa39c..ec40.js gzip 3.45 kB 3.45 kB
hooks-585f07..95a3.js gzip 887 B 887 B
index-c7b63f..fc02.js gzip 227 B 227 B
link-f4d2979..e57b.js gzip 1.29 kB N/A N/A
routerDirect..ebc7.js gzip 284 B 284 B
withRouter-2..db68.js gzip 284 B 284 B
link-d405628..84bb.js gzip N/A 1.28 kB N/A
Overall change 7.71 kB 7.7 kB -9 B
Client Pages Modern Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-97e743e..dule.js gzip 626 B 626 B
_error-b4004..dule.js gzip 2.3 kB 2.3 kB
hooks-696209..dule.js gzip 387 B 387 B
index-a4dd74..dule.js gzip 226 B 226 B
link-653c74f..dule.js gzip 1.26 kB N/A N/A
routerDirect..dule.js gzip 284 B 284 B
withRouter-1..dule.js gzip 282 B 282 B
link-6c23ec5..dule.js gzip N/A 1.25 kB N/A
Overall change 5.37 kB 5.36 kB -8 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_buildManifest.js gzip 273 B 273 B
_buildManife..dule.js gzip 280 B 279 B -1 B
Overall change 553 B 552 B -1 B
Serverless bundles Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_error.js 1.03 MB 1.03 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.03 MB 1.03 MB
link.js 1.07 MB 1.07 MB -58 B
routerDirect.js 1.06 MB 1.06 MB
withRouter.js 1.06 MB 1.06 MB
Overall change 5.26 MB 5.26 MB -58 B
Commit: 2a437fe

@Timer Timer marked this pull request as ready for review August 18, 2020 16:07
@ijjk
Copy link
Member

ijjk commented Aug 18, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
buildDuration 11.1s 10.9s -226ms
nodeModulesSize 57.6 MB 57.6 MB -29.1 kB
Page Load Tests Overall increase ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
/ failed reqs 0 0
/ total time (seconds) 1.937 1.945 ⚠️ +0.01
/ avg req/sec 1290.87 1285.19 ⚠️ -5.68
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.101 1.085 -0.02
/error-in-render avg req/sec 2269.81 2304.57 +34.76
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..4e55.js gzip 10.2 kB 10.2 kB
framework.HASH.js gzip 39 kB 39 kB
main-1ea360d..8d32.js gzip 7.16 kB 7.16 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..dule.js gzip 6.11 kB 6.11 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-ece3b39..dule.js gzip 6.18 kB 6.18 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 52 kB 52 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-1464c..a26f.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-00b8972..6e4e.js gzip 1.3 kB 1.29 kB -8 B
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.7 kB 7.69 kB -8 B
Client Pages Modern Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-e550f..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-72c64d9..dule.js gzip 1.27 kB 1.26 kB -9 B
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.35 kB -9 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_buildManifest.js gzip 322 B 322 B
_buildManife..dule.js gzip 330 B 329 B -1 B
Overall change 652 B 651 B -1 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
index.html gzip 947 B 947 B
link.html gzip 950 B 952 B ⚠️ +2 B
withRouter.html gzip 938 B 938 B
Overall change 2.83 kB 2.84 kB ⚠️ +2 B

Diffs

Diff for _buildManifest.js
@@ -7,7 +7,7 @@ self.__BUILD_MANIFEST = {
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
   ],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-3e536e855e7143324b04.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-f7198173e1b5ab1f4474.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
   ],
Diff for _buildManifest.module.js
@@ -10,7 +10,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
   ],
   "/link": [
-    "static\u002Fchunks\u002Fpages\u002Flink-6fa73e7e8736497268e2.module.js"
+    "static\u002Fchunks\u002Fpages\u002Flink-5f464829244b1ab0bd4b.module.js"
   ],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-3e536e8..143324b04.js
@@ -78,8 +78,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
       var _router = __webpack_require__("elyg");
 
-      var _utils = __webpack_require__("g/15");
-
       var _router2 = __webpack_require__("nOHt");
 
       var cachedObserver;
@@ -198,7 +196,12 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
 
       function Link(props) {
         if (false) {
-          var hasWarned;
+          var hasWarned,
+            optionalProps,
+            optionalPropsGuard,
+            requiredProps,
+            requiredPropsGuard,
+            createPropError;
         }
 
         var p = props.prefetch !== false;
@@ -310,10 +313,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         return _react["default"].cloneElement(child, childProps);
       }
 
-      if (false) {
-        var exact, PropTypes, warn;
-      }
-
       var _default = Link;
       exports["default"] = _default;
Diff for link-6fa73e7..e2.module.js
@@ -74,8 +74,6 @@
 
       var _router = __webpack_require__("elyg");
 
-      var _utils = __webpack_require__("g/15");
-
       var _router2 = __webpack_require__("nOHt");
 
       var cachedObserver;
@@ -194,7 +192,11 @@
 
       function Link(props) {
         if (false) {
-          var hasWarned;
+          var hasWarned,
+            optionalProps,
+            optionalPropsGuard,
+            requiredProps,
+            requiredPropsGuard;
         }
 
         var p = props.prefetch !== false;
@@ -292,10 +294,6 @@
         return _react.default.cloneElement(child, childProps);
       }
 
-      if (false) {
-        var exact, PropTypes, warn;
-      }
-
       var _default = Link;
       exports.default = _default;
Diff for link.html
@@ -36,7 +36,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/pages/link-6fa73e7e8736497268e2.module.js"
+      href="/_next/static/chunks/pages/link-5f464829244b1ab0bd4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -146,13 +146,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-3e536e855e7143324b04.js"
+      src="/_next/static/chunks/pages/link-f7198173e1b5ab1f4474.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-6fa73e7e8736497268e2.module.js"
+      src="/_next/static/chunks/pages/link-5f464829244b1ab0bd4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
buildDuration 12.4s 12.1s -361ms
nodeModulesSize 57.6 MB 57.6 MB -29.1 kB
Client Bundles (main, webpack, commons)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..4e55.js gzip 10.2 kB 10.2 kB
framework.HASH.js gzip 39 kB 39 kB
main-1ea360d..8d32.js gzip 7.16 kB 7.16 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 57.1 kB 57.1 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
677f882d2ed8..dule.js gzip 6.11 kB 6.11 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-ece3b39..dule.js gzip 6.18 kB 6.18 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 52 kB 52 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-1464c..a26f.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-00b8972..6e4e.js gzip 1.3 kB N/A N/A
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
link-000f151..65d4.js gzip N/A 1.29 kB N/A
Overall change 7.7 kB 7.69 kB -8 B
Client Pages Modern Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-e550f..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-72c64d9..dule.js gzip 1.27 kB N/A N/A
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
link-4cfda7a..dule.js gzip N/A 1.26 kB N/A
Overall change 5.36 kB 5.35 kB -9 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_buildManifest.js gzip 322 B 322 B
_buildManife..dule.js gzip 330 B 329 B -1 B
Overall change 652 B 651 B -1 B
Serverless bundles Overall decrease ✓
vercel/next.js canary Timer/next.js replace/prop-types-exact Change
_error.js 1.03 MB 1.03 MB
404.html 4.18 kB 4.18 kB
hooks.html 3.82 kB 3.82 kB
index.js 1.03 MB 1.03 MB
link.js 1.07 MB 1.07 MB -58 B
routerDirect.js 1.07 MB 1.07 MB
withRouter.js 1.07 MB 1.07 MB
Overall change 5.27 MB 5.27 MB -58 B
Commit: 44f7fe4

@kodiakhq kodiakhq bot merged commit ff33e07 into vercel:canary Aug 18, 2020
@Timer Timer deleted the replace/prop-types-exact branch August 18, 2020 17:05
m-lautenbach pushed a commit to m-lautenbach/next.js that referenced this pull request Aug 20, 2020
This PR replaces `prop-types-exact` (only used in this location) with manual property checking.

Right now, malformed properties sent to `<Link>` are silently handled and only emit a warning in the console.
This leads to confusing/unexpected errors because we try to read a value that is undefined.

To fix this, we'll now throw a proper error when `<Link>` is misused. **This still isn't optimal, however, because we don't have a component stack trace we can give the user**.
We're not going to be able to give the user actionable instructions until React 16.14 at a minimum.

---

Fixes vercel#13951
Fixes vercel#16107
Closes vercel#13962
@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link without href throws error Forgetting to add href to NextLink shows a bad error
2 participants