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

Fix idleTimeout error being thrown in route loader #22775

Merged

Conversation

shuding
Copy link
Member

@shuding shuding commented Mar 4, 2021

In the current implementation, idleTimeout will always be thrown even if it didn't time out and Promise.race was resolved. This causes the error Error: Route did not complete loading on every route transition and Chrome Devtools will pause code execution if you have "Pause on exceptions" enabled.

This PR adds resolvePromiseWithTimeout which does the same thing as Promise.race and idleTimeout, but it cancels the rejection when it resolves successfully, in which case the error won't be thrown.

Fixes #21543.

@ijjk
Copy link
Member

ijjk commented Mar 4, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 13.2s 13.5s ⚠️ +309ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
/ failed reqs 0 0
/ total time (seconds) 2.417 2.433 ⚠️ +0.02
/ avg req/sec 1034.51 1027.37 ⚠️ -7.14
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.634 1.584 -0.05
/error-in-render avg req/sec 1529.92 1577.79 +47.87
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
677f882d2ed8..e7a0.js gzip 13.4 kB 13.4 kB ⚠️ +7 B
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.65 kB 6.65 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.7 kB 59.7 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
amp-e3e9bc99..932c.js gzip 536 B 536 B
hooks-5023ef..3670.js gzip 888 B 888 B
index-3a2b03..c677.js gzip 227 B 227 B
link-177412b..043e.js gzip 1.67 kB 1.67 kB
routerDirect..1a66.js gzip 303 B 303 B
withRouter-9..1b7d.js gzip 302 B 302 B
Overall change 8.66 kB 8.66 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 347 B 347 B
Overall change 347 B 347 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
index.html gzip 613 B 614 B ⚠️ +1 B
link.html gzip 620 B 620 B
withRouter.html gzip 609 B 608 B -1 B
Overall change 1.84 kB 1.84 kB

Diffs

Diff for 677f882d2ed8..5ec6837e3.js
@@ -589,13 +589,21 @@
           script.src = src;
           document.body.appendChild(script);
         });
-      }
+      } // Resolve a promise that times out after given amount of milliseconds.
 
-      function idleTimeout(ms, err) {
-        return new Promise(function(_resolve, reject) {
-          return (0, _requestIdleCallback.requestIdleCallback)(function() {
+      function resolvePromiseWithTimeout(p, ms, err) {
+        return new Promise(function(resolve, reject) {
+          var cancelled = false;
+          p.then(function(r) {
+            // Resolved, cancel the timeout
+            cancelled = true;
+            resolve(r);
+          })["catch"](reject);
+          (0, _requestIdleCallback.requestIdleCallback)(function() {
             return setTimeout(function() {
-              return reject(err);
+              if (!cancelled) {
+                reject(err);
+              }
             }, ms);
           });
         });
@@ -620,13 +628,11 @@
             cb && cb();
           };
         });
-        return Promise.race([
+        return resolvePromiseWithTimeout(
           onBuildManifest,
-          idleTimeout(
-            MS_MAX_IDLE_DELAY,
-            markAssetError(new Error("Failed to load client build manifest"))
-          )
-        ]);
+          MS_MAX_IDLE_DELAY,
+          markAssetError(new Error("Failed to load client build manifest"))
+        );
       }
 
       function getFilesForRoute(assetPrefix, route) {
@@ -778,19 +784,17 @@
                             );
                             styles = _yield$Promise$all2[1];
                             _context.next = 13;
-                            return Promise.race([
+                            return resolvePromiseWithTimeout(
                               _this.whenEntrypoint(route),
-                              idleTimeout(
-                                MS_MAX_IDLE_DELAY,
-                                markAssetError(
-                                  new Error(
-                                    "Route did not complete loading: ".concat(
-                                      route
-                                    )
+                              MS_MAX_IDLE_DELAY,
+                              markAssetError(
+                                new Error(
+                                  "Route did not complete loading: ".concat(
+                                    route
                                   )
                                 )
                               )
-                            ]);
+                            );
 
                           case 13:
                             entrypoint = _context.sent;
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 16s 15.7s -279ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
677f882d2ed8..e7a0.js gzip 13.4 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.65 kB 6.65 kB
webpack-HASH.js gzip 751 B 751 B
677f882d2ed8..af39.js gzip N/A 13.4 kB N/A
Overall change 59.7 kB 59.7 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
amp-e3e9bc99..932c.js gzip 536 B 536 B
hooks-5023ef..3670.js gzip 888 B 888 B
index-3a2b03..c677.js gzip 227 B 227 B
link-177412b..043e.js gzip 1.67 kB 1.67 kB
routerDirect..1a66.js gzip 303 B 303 B
withRouter-9..1b7d.js gzip 302 B 302 B
Overall change 8.66 kB 8.66 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 347 B 347 B
Overall change 347 B 347 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_error.js 1.02 MB 1.02 MB
404.html 2.67 kB 2.67 kB
500.html 2.65 kB 2.65 kB
amp.amp.html 10.5 kB 10.5 kB
amp.html 1.86 kB 1.86 kB
hooks.html 1.92 kB 1.92 kB
index.js 1.02 MB 1.02 MB
link.js 1.08 MB 1.08 MB ⚠️ +292 B
routerDirect.js 1.07 MB 1.07 MB ⚠️ +292 B
withRouter.js 1.07 MB 1.07 MB ⚠️ +292 B
Overall change 5.27 MB 5.27 MB ⚠️ +876 B

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 15.1s 15.3s ⚠️ +119ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
/ failed reqs 0 0
/ total time (seconds) 2.3 2.432 ⚠️ +0.13
/ avg req/sec 1086.76 1028.07 ⚠️ -58.69
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.6 1.586 -0.01
/error-in-render avg req/sec 1562.1 1576.61 +14.51
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
597-74632e79..1d47.js gzip 13.3 kB 13.3 kB ⚠️ +7 B
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.6 kB 6.6 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 60.1 kB 60.1 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-aedc815..1421.js gzip 1.26 kB 1.26 kB
_error-71ec2..1a96.js gzip 3.38 kB 3.38 kB
amp-33a09cb0..6745.js gzip 536 B 536 B
hooks-4e968a..f870.js gzip 902 B 902 B
index-5c6845..f75c.js gzip 230 B 230 B
link-99f0c6c..b84a.js gzip 1.65 kB 1.65 kB
routerDirect..bb56.js gzip 306 B 306 B
withRouter-7..2133.js gzip 302 B 302 B
Overall change 8.57 kB 8.57 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 326 B 326 B
Overall change 326 B 326 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
index.html gzip 586 B 585 B -1 B
link.html gzip 593 B 591 B -2 B
withRouter.html gzip 582 B 581 B -1 B
Overall change 1.76 kB 1.76 kB -4 B

Diffs

Diff for 677f882d2ed8..eaa79e7a0.js
@@ -304,28 +304,34 @@
       function f(t) {
         return Object.defineProperty(t, l, {});
       }
-      function h(t, e) {
-        return new Promise(function(r, n) {
-          return (0, u.requestIdleCallback)(function() {
-            return setTimeout(function() {
-              return n(e);
-            }, t);
-          });
+      function h(t, e, r) {
+        return new Promise(function(n, o) {
+          var a = !1;
+          t
+            .then(function(t) {
+              (a = !0), n(t);
+            })
+            .catch(o),
+            (0, u.requestIdleCallback)(function() {
+              return setTimeout(function() {
+                a || o(r);
+              }, e);
+            });
         });
       }
       function p() {
-        if (self.__BUILD_MANIFEST)
-          return Promise.resolve(self.__BUILD_MANIFEST);
-        var t = new Promise(function(t) {
-          var e = self.__BUILD_MANIFEST_CB;
-          self.__BUILD_MANIFEST_CB = function() {
-            t(self.__BUILD_MANIFEST), e && e();
-          };
-        });
-        return Promise.race([
-          t,
-          h(3800, f(new Error("Failed to load client build manifest")))
-        ]);
+        return self.__BUILD_MANIFEST
+          ? Promise.resolve(self.__BUILD_MANIFEST)
+          : h(
+              new Promise(function(t) {
+                var e = self.__BUILD_MANIFEST_CB;
+                self.__BUILD_MANIFEST_CB = function() {
+                  t(self.__BUILD_MANIFEST), e && e();
+                };
+              }),
+              3800,
+              f(new Error("Failed to load client build manifest"))
+            );
       }
       function d(t, e) {
         return p().then(function(r) {
@@ -448,19 +454,15 @@
                               (y = o(l, 2)),
                               (m = y[1]),
                               (n.next = 13),
-                              Promise.race([
+                              h(
                                 i.whenEntrypoint(r),
-                                h(
-                                  3800,
-                                  f(
-                                    new Error(
-                                      "Route did not complete loading: ".concat(
-                                        r
-                                      )
-                                    )
+                                3800,
+                                f(
+                                  new Error(
+                                    "Route did not complete loading: ".concat(r)
                                   )
                                 )
-                              ])
+                              )
                             );
                           case 13:
                             return (
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "DRJfCj8LNccfvgduxiqUJ",
+        "buildId": "ChDZFewhfx98NPoodWL2b",
         "isFallback": false,
         "gip": true
       }
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/DRJfCj8LNccfvgduxiqUJ/_buildManifest.js"
+      src="/_next/static/ChDZFewhfx98NPoodWL2b/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/DRJfCj8LNccfvgduxiqUJ/_ssgManifest.js"
+      src="/_next/static/ChDZFewhfx98NPoodWL2b/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "DRJfCj8LNccfvgduxiqUJ",
+        "buildId": "ChDZFewhfx98NPoodWL2b",
         "isFallback": false,
         "gip": true
       }
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/DRJfCj8LNccfvgduxiqUJ/_buildManifest.js"
+      src="/_next/static/ChDZFewhfx98NPoodWL2b/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/DRJfCj8LNccfvgduxiqUJ/_ssgManifest.js"
+      src="/_next/static/ChDZFewhfx98NPoodWL2b/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "DRJfCj8LNccfvgduxiqUJ",
+        "buildId": "ChDZFewhfx98NPoodWL2b",
         "isFallback": false,
         "gip": true
       }
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/DRJfCj8LNccfvgduxiqUJ/_buildManifest.js"
+      src="/_next/static/ChDZFewhfx98NPoodWL2b/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/DRJfCj8LNccfvgduxiqUJ/_ssgManifest.js"
+      src="/_next/static/ChDZFewhfx98NPoodWL2b/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: f8a47d4

Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting to land, but changes look good to me 👍

@ijjk
Copy link
Member

ijjk commented Mar 4, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 9.7s 9.9s ⚠️ +189ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
/ failed reqs 0 0
/ total time (seconds) 1.708 1.73 ⚠️ +0.02
/ avg req/sec 1463.97 1445.47 ⚠️ -18.5
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.073 1.066 -0.01
/error-in-render avg req/sec 2330.61 2344.29 +13.68
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
677f882d2ed8..e7a0.js gzip 13.4 kB 13.4 kB ⚠️ +7 B
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.65 kB 6.65 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.7 kB 59.7 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
amp-e3e9bc99..932c.js gzip 536 B 536 B
hooks-5023ef..3670.js gzip 888 B 888 B
index-3a2b03..c677.js gzip 227 B 227 B
link-177412b..043e.js gzip 1.67 kB 1.67 kB
routerDirect..1a66.js gzip 303 B 303 B
withRouter-9..1b7d.js gzip 302 B 302 B
Overall change 8.66 kB 8.66 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 347 B 347 B
Overall change 347 B 347 B
Rendered Page Sizes
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
index.html gzip 613 B 614 B ⚠️ +1 B
link.html gzip 620 B 620 B
withRouter.html gzip 609 B 608 B -1 B
Overall change 1.84 kB 1.84 kB

Diffs

Diff for 677f882d2ed8..5ec6837e3.js
@@ -589,13 +589,21 @@
           script.src = src;
           document.body.appendChild(script);
         });
-      }
+      } // Resolve a promise that times out after given amount of milliseconds.
 
-      function idleTimeout(ms, err) {
-        return new Promise(function(_resolve, reject) {
-          return (0, _requestIdleCallback.requestIdleCallback)(function() {
+      function resolvePromiseWithTimeout(p, ms, err) {
+        return new Promise(function(resolve, reject) {
+          var cancelled = false;
+          p.then(function(r) {
+            // Resolved, cancel the timeout
+            cancelled = true;
+            resolve(r);
+          })["catch"](reject);
+          (0, _requestIdleCallback.requestIdleCallback)(function() {
             return setTimeout(function() {
-              return reject(err);
+              if (!cancelled) {
+                reject(err);
+              }
             }, ms);
           });
         });
@@ -620,13 +628,11 @@
             cb && cb();
           };
         });
-        return Promise.race([
+        return resolvePromiseWithTimeout(
           onBuildManifest,
-          idleTimeout(
-            MS_MAX_IDLE_DELAY,
-            markAssetError(new Error("Failed to load client build manifest"))
-          )
-        ]);
+          MS_MAX_IDLE_DELAY,
+          markAssetError(new Error("Failed to load client build manifest"))
+        );
       }
 
       function getFilesForRoute(assetPrefix, route) {
@@ -778,19 +784,17 @@
                             );
                             styles = _yield$Promise$all2[1];
                             _context.next = 13;
-                            return Promise.race([
+                            return resolvePromiseWithTimeout(
                               _this.whenEntrypoint(route),
-                              idleTimeout(
-                                MS_MAX_IDLE_DELAY,
-                                markAssetError(
-                                  new Error(
-                                    "Route did not complete loading: ".concat(
-                                      route
-                                    )
+                              MS_MAX_IDLE_DELAY,
+                              markAssetError(
+                                new Error(
+                                  "Route did not complete loading: ".concat(
+                                    route
                                   )
                                 )
                               )
-                            ]);
+                            );
 
                           case 13:
                             entrypoint = _context.sent;
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 11.5s 11.4s -127ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
677f882d2ed8..e7a0.js gzip 13.4 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.65 kB 6.65 kB
webpack-HASH.js gzip 751 B 751 B
677f882d2ed8..af39.js gzip N/A 13.4 kB N/A
Overall change 59.7 kB 59.7 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
amp-e3e9bc99..932c.js gzip 536 B 536 B
hooks-5023ef..3670.js gzip 888 B 888 B
index-3a2b03..c677.js gzip 227 B 227 B
link-177412b..043e.js gzip 1.67 kB 1.67 kB
routerDirect..1a66.js gzip 303 B 303 B
withRouter-9..1b7d.js gzip 302 B 302 B
Overall change 8.66 kB 8.66 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 347 B 347 B
Overall change 347 B 347 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_error.js 1.02 MB 1.02 MB
404.html 2.67 kB 2.67 kB
500.html 2.65 kB 2.65 kB
amp.amp.html 10.5 kB 10.5 kB
amp.html 1.86 kB 1.86 kB
hooks.html 1.92 kB 1.92 kB
index.js 1.02 MB 1.02 MB
link.js 1.08 MB 1.08 MB ⚠️ +292 B
routerDirect.js 1.07 MB 1.07 MB ⚠️ +292 B
withRouter.js 1.07 MB 1.07 MB ⚠️ +292 B
Overall change 5.27 MB 5.27 MB ⚠️ +876 B

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 11.6s 11.6s ⚠️ +47ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
/ failed reqs 0 0
/ total time (seconds) 1.75 1.746 0
/ avg req/sec 1428.32 1431.97 +3.65
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.07 1.079 ⚠️ +0.01
/error-in-render avg req/sec 2337.28 2317.61 ⚠️ -19.67
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
597-74632e79..1d47.js gzip 13.3 kB 13.3 kB ⚠️ +7 B
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.6 kB 6.6 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 60.1 kB 60.1 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-aedc815..1421.js gzip 1.26 kB 1.26 kB
_error-71ec2..1a96.js gzip 3.38 kB 3.38 kB
amp-33a09cb0..6745.js gzip 536 B 536 B
hooks-4e968a..f870.js gzip 902 B 902 B
index-5c6845..f75c.js gzip 230 B 230 B
link-99f0c6c..b84a.js gzip 1.65 kB 1.65 kB
routerDirect..bb56.js gzip 306 B 306 B
withRouter-7..2133.js gzip 302 B 302 B
Overall change 8.57 kB 8.57 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 326 B 326 B
Overall change 326 B 326 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
index.html gzip 586 B 585 B -1 B
link.html gzip 593 B 591 B -2 B
withRouter.html gzip 582 B 581 B -1 B
Overall change 1.76 kB 1.76 kB -4 B

Diffs

Diff for 677f882d2ed8..eaa79e7a0.js
@@ -304,28 +304,34 @@
       function f(t) {
         return Object.defineProperty(t, l, {});
       }
-      function h(t, e) {
-        return new Promise(function(r, n) {
-          return (0, u.requestIdleCallback)(function() {
-            return setTimeout(function() {
-              return n(e);
-            }, t);
-          });
+      function h(t, e, r) {
+        return new Promise(function(n, o) {
+          var a = !1;
+          t
+            .then(function(t) {
+              (a = !0), n(t);
+            })
+            .catch(o),
+            (0, u.requestIdleCallback)(function() {
+              return setTimeout(function() {
+                a || o(r);
+              }, e);
+            });
         });
       }
       function p() {
-        if (self.__BUILD_MANIFEST)
-          return Promise.resolve(self.__BUILD_MANIFEST);
-        var t = new Promise(function(t) {
-          var e = self.__BUILD_MANIFEST_CB;
-          self.__BUILD_MANIFEST_CB = function() {
-            t(self.__BUILD_MANIFEST), e && e();
-          };
-        });
-        return Promise.race([
-          t,
-          h(3800, f(new Error("Failed to load client build manifest")))
-        ]);
+        return self.__BUILD_MANIFEST
+          ? Promise.resolve(self.__BUILD_MANIFEST)
+          : h(
+              new Promise(function(t) {
+                var e = self.__BUILD_MANIFEST_CB;
+                self.__BUILD_MANIFEST_CB = function() {
+                  t(self.__BUILD_MANIFEST), e && e();
+                };
+              }),
+              3800,
+              f(new Error("Failed to load client build manifest"))
+            );
       }
       function d(t, e) {
         return p().then(function(r) {
@@ -448,19 +454,15 @@
                               (y = o(l, 2)),
                               (m = y[1]),
                               (n.next = 13),
-                              Promise.race([
+                              h(
                                 i.whenEntrypoint(r),
-                                h(
-                                  3800,
-                                  f(
-                                    new Error(
-                                      "Route did not complete loading: ".concat(
-                                        r
-                                      )
-                                    )
+                                3800,
+                                f(
+                                  new Error(
+                                    "Route did not complete loading: ".concat(r)
                                   )
                                 )
-                              ])
+                              )
                             );
                           case 13:
                             return (
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "1a_mz7i-g7lECPoSphIDJ",
+        "buildId": "vPwxivjuokcBtf7_1YqyS",
         "isFallback": false,
         "gip": true
       }
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/1a_mz7i-g7lECPoSphIDJ/_buildManifest.js"
+      src="/_next/static/vPwxivjuokcBtf7_1YqyS/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/1a_mz7i-g7lECPoSphIDJ/_ssgManifest.js"
+      src="/_next/static/vPwxivjuokcBtf7_1YqyS/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "1a_mz7i-g7lECPoSphIDJ",
+        "buildId": "vPwxivjuokcBtf7_1YqyS",
         "isFallback": false,
         "gip": true
       }
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/1a_mz7i-g7lECPoSphIDJ/_buildManifest.js"
+      src="/_next/static/vPwxivjuokcBtf7_1YqyS/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/1a_mz7i-g7lECPoSphIDJ/_ssgManifest.js"
+      src="/_next/static/vPwxivjuokcBtf7_1YqyS/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "1a_mz7i-g7lECPoSphIDJ",
+        "buildId": "vPwxivjuokcBtf7_1YqyS",
         "isFallback": false,
         "gip": true
       }
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/1a_mz7i-g7lECPoSphIDJ/_buildManifest.js"
+      src="/_next/static/vPwxivjuokcBtf7_1YqyS/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/1a_mz7i-g7lECPoSphIDJ/_ssgManifest.js"
+      src="/_next/static/vPwxivjuokcBtf7_1YqyS/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: e90abb0

@ijjk ijjk added the type: next label Mar 4, 2021
@ijjk
Copy link
Member

ijjk commented Mar 5, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 13.8s 13.7s -90ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Page Load Tests Overall increase ✓
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
/ failed reqs 0 0
/ total time (seconds) 2.47 2.481 ⚠️ +0.01
/ avg req/sec 1012.05 1007.73 ⚠️ -4.32
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.756 1.695 -0.06
/error-in-render avg req/sec 1423.88 1474.95 +51.07
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
677f882d2ed8..e7a0.js gzip 13.4 kB 13.4 kB ⚠️ +7 B
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.64 kB 6.64 kB
webpack-HASH.js gzip 751 B 751 B
Overall change 59.7 kB 59.7 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
amp-e3e9bc99..932c.js gzip 536 B 536 B
hooks-5023ef..3670.js gzip 888 B 888 B
index-3a2b03..c677.js gzip 227 B 227 B
link-177412b..043e.js gzip 1.67 kB 1.67 kB
routerDirect..1a66.js gzip 303 B 303 B
withRouter-9..1b7d.js gzip 302 B 302 B
Overall change 8.66 kB 8.66 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 347 B 347 B
Overall change 347 B 347 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
index.html gzip 613 B 613 B
link.html gzip 621 B 620 B -1 B
withRouter.html gzip 608 B 607 B -1 B
Overall change 1.84 kB 1.84 kB -2 B

Diffs

Diff for 677f882d2ed8..5ec6837e3.js
@@ -589,13 +589,21 @@
           script.src = src;
           document.body.appendChild(script);
         });
-      }
+      } // Resolve a promise that times out after given amount of milliseconds.
 
-      function idleTimeout(ms, err) {
-        return new Promise(function(_resolve, reject) {
-          return (0, _requestIdleCallback.requestIdleCallback)(function() {
+      function resolvePromiseWithTimeout(p, ms, err) {
+        return new Promise(function(resolve, reject) {
+          var cancelled = false;
+          p.then(function(r) {
+            // Resolved, cancel the timeout
+            cancelled = true;
+            resolve(r);
+          })["catch"](reject);
+          (0, _requestIdleCallback.requestIdleCallback)(function() {
             return setTimeout(function() {
-              return reject(err);
+              if (!cancelled) {
+                reject(err);
+              }
             }, ms);
           });
         });
@@ -620,13 +628,11 @@
             cb && cb();
           };
         });
-        return Promise.race([
+        return resolvePromiseWithTimeout(
           onBuildManifest,
-          idleTimeout(
-            MS_MAX_IDLE_DELAY,
-            markAssetError(new Error("Failed to load client build manifest"))
-          )
-        ]);
+          MS_MAX_IDLE_DELAY,
+          markAssetError(new Error("Failed to load client build manifest"))
+        );
       }
 
       function getFilesForRoute(assetPrefix, route) {
@@ -778,19 +784,17 @@
                             );
                             styles = _yield$Promise$all2[1];
                             _context.next = 13;
-                            return Promise.race([
+                            return resolvePromiseWithTimeout(
                               _this.whenEntrypoint(route),
-                              idleTimeout(
-                                MS_MAX_IDLE_DELAY,
-                                markAssetError(
-                                  new Error(
-                                    "Route did not complete loading: ".concat(
-                                      route
-                                    )
+                              MS_MAX_IDLE_DELAY,
+                              markAssetError(
+                                new Error(
+                                  "Route did not complete loading: ".concat(
+                                    route
                                   )
                                 )
                               )
-                            ]);
+                            );
 
                           case 13:
                             entrypoint = _context.sent;
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       as="script"
     />
     <link
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.42120b530b65ec6837e3.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c6f31967688cbdf31d2b.js"
       async=""
     ></script>
     <script

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 16.1s 16.2s ⚠️ +120ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
677f882d2ed8..e7a0.js gzip 13.4 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-HASH.js gzip 6.64 kB 6.64 kB
webpack-HASH.js gzip 751 B 751 B
677f882d2ed8..af39.js gzip N/A 13.4 kB N/A
Overall change 59.7 kB 59.7 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.3 kB 31.3 kB
Overall change 31.3 kB 31.3 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-2a09aa2..4a98.js gzip 1.28 kB 1.28 kB
_error-8b758..aef6.js gzip 3.46 kB 3.46 kB
amp-e3e9bc99..932c.js gzip 536 B 536 B
hooks-5023ef..3670.js gzip 888 B 888 B
index-3a2b03..c677.js gzip 227 B 227 B
link-177412b..043e.js gzip 1.67 kB 1.67 kB
routerDirect..1a66.js gzip 303 B 303 B
withRouter-9..1b7d.js gzip 302 B 302 B
Overall change 8.66 kB 8.66 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 347 B 347 B
Overall change 347 B 347 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_error.js 1.02 MB 1.02 MB
404.html 2.67 kB 2.67 kB
500.html 2.65 kB 2.65 kB
amp.amp.html 10.5 kB 10.5 kB
amp.html 1.86 kB 1.86 kB
hooks.html 1.92 kB 1.92 kB
index.js 1.02 MB 1.02 MB
link.js 1.08 MB 1.08 MB ⚠️ +292 B
routerDirect.js 1.07 MB 1.07 MB ⚠️ +292 B
withRouter.js 1.07 MB 1.07 MB ⚠️ +292 B
Overall change 5.27 MB 5.27 MB ⚠️ +876 B

Webpack 5 Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
buildDuration 16.2s 16.3s ⚠️ +140ms
nodeModulesSize 42.8 MB 42.8 MB ⚠️ +663 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
/ failed reqs 0 0
/ total time (seconds) 2.454 2.451 0
/ avg req/sec 1018.72 1020.06 +1.34
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.647 1.689 ⚠️ +0.04
/error-in-render avg req/sec 1517.89 1480.31 ⚠️ -37.58
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
597-74632e79..1d47.js gzip 13.3 kB 13.3 kB ⚠️ +7 B
framework.HASH.js gzip 39.3 kB 39.3 kB
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 954 B 954 B
Overall change 60.1 kB 60.1 kB ⚠️ +7 B
Legacy Client Bundles (polyfills)
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
polyfills-HASH.js gzip 31.1 kB 31.1 kB
Overall change 31.1 kB 31.1 kB
Client Pages
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_app-aedc815..1421.js gzip 1.26 kB 1.26 kB
_error-71ec2..1a96.js gzip 3.38 kB 3.38 kB
amp-33a09cb0..6745.js gzip 536 B 536 B
hooks-4e968a..f870.js gzip 902 B 902 B
index-5c6845..f75c.js gzip 230 B 230 B
link-99f0c6c..b84a.js gzip 1.65 kB 1.65 kB
routerDirect..bb56.js gzip 306 B 306 B
withRouter-7..2133.js gzip 302 B 302 B
Overall change 8.57 kB 8.57 kB
Client Build Manifests
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
_buildManifest.js gzip 326 B 326 B
Overall change 326 B 326 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary shuding/next.js fix-route-loading-timeout-error-thrown Change
index.html gzip 587 B 585 B -2 B
link.html gzip 593 B 591 B -2 B
withRouter.html gzip 582 B 580 B -2 B
Overall change 1.76 kB 1.76 kB -6 B

Diffs

Diff for 677f882d2ed8..eaa79e7a0.js
@@ -304,28 +304,34 @@
       function f(t) {
         return Object.defineProperty(t, l, {});
       }
-      function h(t, e) {
-        return new Promise(function(r, n) {
-          return (0, u.requestIdleCallback)(function() {
-            return setTimeout(function() {
-              return n(e);
-            }, t);
-          });
+      function h(t, e, r) {
+        return new Promise(function(n, o) {
+          var a = !1;
+          t
+            .then(function(t) {
+              (a = !0), n(t);
+            })
+            .catch(o),
+            (0, u.requestIdleCallback)(function() {
+              return setTimeout(function() {
+                a || o(r);
+              }, e);
+            });
         });
       }
       function p() {
-        if (self.__BUILD_MANIFEST)
-          return Promise.resolve(self.__BUILD_MANIFEST);
-        var t = new Promise(function(t) {
-          var e = self.__BUILD_MANIFEST_CB;
-          self.__BUILD_MANIFEST_CB = function() {
-            t(self.__BUILD_MANIFEST), e && e();
-          };
-        });
-        return Promise.race([
-          t,
-          h(3800, f(new Error("Failed to load client build manifest")))
-        ]);
+        return self.__BUILD_MANIFEST
+          ? Promise.resolve(self.__BUILD_MANIFEST)
+          : h(
+              new Promise(function(t) {
+                var e = self.__BUILD_MANIFEST_CB;
+                self.__BUILD_MANIFEST_CB = function() {
+                  t(self.__BUILD_MANIFEST), e && e();
+                };
+              }),
+              3800,
+              f(new Error("Failed to load client build manifest"))
+            );
       }
       function d(t, e) {
         return p().then(function(r) {
@@ -448,19 +454,15 @@
                               (y = o(l, 2)),
                               (m = y[1]),
                               (n.next = 13),
-                              Promise.race([
+                              h(
                                 i.whenEntrypoint(r),
-                                h(
-                                  3800,
-                                  f(
-                                    new Error(
-                                      "Route did not complete loading: ".concat(
-                                        r
-                                      )
-                                    )
+                                3800,
+                                f(
+                                  new Error(
+                                    "Route did not complete loading: ".concat(r)
                                   )
                                 )
-                              ])
+                              )
                             );
                           case 13:
                             return (
Diff for index.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/",
         "query": {},
-        "buildId": "C90o8N8ZYlYHIsUPzRxay",
+        "buildId": "4srxU_2UyrqKeSTjf3Gi9",
         "isFallback": false,
         "gip": true
       }
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/C90o8N8ZYlYHIsUPzRxay/_buildManifest.js"
+      src="/_next/static/4srxU_2UyrqKeSTjf3Gi9/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/C90o8N8ZYlYHIsUPzRxay/_ssgManifest.js"
+      src="/_next/static/4srxU_2UyrqKeSTjf3Gi9/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for link.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -48,7 +48,7 @@
         "props": { "pageProps": {} },
         "page": "/link",
         "query": {},
-        "buildId": "C90o8N8ZYlYHIsUPzRxay",
+        "buildId": "4srxU_2UyrqKeSTjf3Gi9",
         "isFallback": false,
         "gip": true
       }
@@ -70,7 +70,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -82,11 +82,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/C90o8N8ZYlYHIsUPzRxay/_buildManifest.js"
+      src="/_next/static/4srxU_2UyrqKeSTjf3Gi9/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/C90o8N8ZYlYHIsUPzRxay/_ssgManifest.js"
+      src="/_next/static/4srxU_2UyrqKeSTjf3Gi9/_ssgManifest.js"
       async=""
     ></script>
   </body>
Diff for withRouter.html
@@ -22,7 +22,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       as="script"
     />
     <link
@@ -43,7 +43,7 @@
         "props": { "pageProps": {} },
         "page": "/withRouter",
         "query": {},
-        "buildId": "C90o8N8ZYlYHIsUPzRxay",
+        "buildId": "4srxU_2UyrqKeSTjf3Gi9",
         "isFallback": false,
         "gip": true
       }
@@ -65,7 +65,7 @@
       async=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.45a1f5b1723eaa79e7a0.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4ca177ac12b2a063af39.js"
       async=""
     ></script>
     <script
@@ -77,11 +77,11 @@
       async=""
     ></script>
     <script
-      src="/_next/static/C90o8N8ZYlYHIsUPzRxay/_buildManifest.js"
+      src="/_next/static/4srxU_2UyrqKeSTjf3Gi9/_buildManifest.js"
       async=""
     ></script>
     <script
-      src="/_next/static/C90o8N8ZYlYHIsUPzRxay/_ssgManifest.js"
+      src="/_next/static/4srxU_2UyrqKeSTjf3Gi9/_ssgManifest.js"
       async=""
     ></script>
   </body>
Commit: 22e1577

This was referenced Mar 16, 2021
@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 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.

Error: Route did not complete loading: /projects
2 participants