KEMBAR78
Fix render cancel behavior by Timer · Pull Request #16462 · vercel/next.js · GitHub
Skip to content

Conversation

Timer
Copy link
Member

@Timer Timer commented Aug 22, 2020

This pull request correctly tracks render cancelation behavior. Prior to this PR, we'd have an unhandled rejection that left the app in a bad state and no routeChangeError event was fired.


Closes #16424
Fixes #16445

@ijjk
Copy link
Member

ijjk commented Aug 22, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
buildDuration 9s 9.9s ⚠️ +922ms
nodeModulesSize 57.5 MB 57.5 MB ⚠️ +1.7 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
/ failed reqs 0 0
/ total time (seconds) 1.693 1.869 ⚠️ +0.18
/ avg req/sec 1476.94 1337.83 ⚠️ -139.11
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 0.925 1.033 ⚠️ +0.11
/error-in-render avg req/sec 2702.08 2421.14 ⚠️ -280.94
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
677f882d2ed8..1962.js gzip 10.2 kB 10.3 kB ⚠️ +20 B
framework.HASH.js gzip 39 kB 39 kB
main-3aeb17d..193e.js gzip 7.2 kB 7.2 kB -5 B
webpack-e067..f178.js gzip 751 B 751 B
Overall change 57.2 kB 57.2 kB ⚠️ +15 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
677f882d2ed8..dule.js gzip 6.11 kB 6.12 kB ⚠️ +13 B
framework.HA..dule.js gzip 39 kB 39 kB
main-e67bd4d..dule.js gzip 6.21 kB 6.24 kB ⚠️ +35 B
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 52 kB 52.1 kB ⚠️ +48 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-28298..e0c9.js gzip 3.44 kB 3.44 kB
hooks-89731c..c609.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-000f151..65d4.js gzip 1.29 kB 1.29 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.69 kB 7.69 kB
Client Pages Modern
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-65c8a..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-4cfda7a..dule.js gzip 1.26 kB 1.26 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.35 kB 5.35 kB
Client Build Manifests
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
_buildManifest.js gzip 322 B 322 B
_buildManife..dule.js gzip 330 B 330 B
Overall change 652 B 652 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
index.html gzip 945 B 947 B ⚠️ +2 B
link.html gzip 952 B 953 B ⚠️ +1 B
withRouter.html gzip 937 B 939 B ⚠️ +2 B
Overall change 2.83 kB 2.84 kB ⚠️ +5 B

Diffs

Diff for 677f882d2ed8..630f20327.js
@@ -1321,7 +1321,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                               query,
                               cleanedAs,
                               routeInfo
-                            );
+                            )["catch"](function(e) {
+                              if (e.cancelled) error = error || e;
+                              else throw e;
+                            });
 
                           case 60:
                             if (!error) {
Diff for 677f882d2ed8..92.module.js
@@ -1053,7 +1053,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
               var appComp;
             }
 
-            await this.set(route, pathname, query, cleanedAs, routeInfo);
+            await this.set(route, pathname, query, cleanedAs, routeInfo).catch(
+              e => {
+                if (e.cancelled) error = error || e;
+                else throw e;
+              }
+            );
 
             if (error) {
               Router.events.emit("routeChangeError", error, cleanedAs);
Diff for main-18bcd2a..3f.module.js
@@ -479,6 +479,11 @@
         try {
           await doRender(renderingProps);
         } catch (renderErr) {
+          // bubble up cancelation errors
+          if (renderErr.cancelled) {
+            throw renderErr;
+          }
+
           if (false) {
           }
 
@@ -682,7 +687,7 @@
         );
       };
 
-      async function doRender(_ref6) {
+      function doRender(_ref6) {
         var { App, Component, props, err, styleSheets } = _ref6;
         Component = Component || lastAppProps.Component;
         props = props || lastAppProps.props;
@@ -698,6 +703,7 @@
 
         lastAppProps = appProps;
         var resolvePromise;
+        var renderPromiseReject;
         var renderPromise = new Promise((resolve, reject) => {
           if (lastRenderReject) {
             lastRenderReject();
@@ -708,9 +714,11 @@
             resolve();
           };
 
-          lastRenderReject = () => {
+          renderPromiseReject = lastRenderReject = () => {
             lastRenderReject = null;
-            reject();
+            var error = new Error("Cancel rendering route");
+            error.cancelled = true;
+            reject(error);
           };
         }); // TODO: consider replacing this with real `<style>` tags that have
         // plain-text CSS content that's provided by RouteInfo. That'd remove the
@@ -727,8 +735,13 @@
             false
           ) {
             return Promise.resolve([]);
-          }
+          } // Clean up previous render if canceling:
 
+          [].slice
+            .call(document.querySelectorAll("link[data-n-staging]"))
+            .forEach(el => {
+              el.parentNode.removeChild(el);
+            });
           var referenceNode = [].slice
             .call(document.querySelectorAll("link[data-n-g], link[data-n-p]"))
             .pop();
@@ -777,19 +790,6 @@
           });
         }
 
-        function onAbort() {
-          [].slice
-            .call(document.querySelectorAll("link[data-n-staging]"))
-            .forEach(el => {
-              el.parentNode.removeChild(el);
-            });
-        }
-
-        renderPromise.catch(abortError => {
-          onAbort();
-          throw abortError;
-        });
-
         function onCommit() {
           if (
             // We can skip this during hydration. Running it wont cause any harm, but
@@ -829,9 +829,26 @@
           )
         ); // We catch runtime errors using componentDidCatch which will trigger renderError
 
-        await onStart();
-        renderReactElement(false ? /*#__PURE__*/ undefined : elem, appElement);
-        await renderPromise;
+        return Promise.race([
+          // Download required CSS assets first:
+          onStart()
+            .then(() => {
+              // Ensure a new render has not been started:
+              if (renderPromiseReject === lastRenderReject) {
+                // Queue rendering:
+                renderReactElement(
+                  false ? /*#__PURE__*/ undefined : elem,
+                  appElement
+                );
+              }
+            })
+            .then(
+              () =>
+                // Wait for rendering to complete:
+                renderPromise
+            ), // Bail early on route cancelation (rejection):
+          renderPromise
+        ]);
       }
 
       function Root(_ref7) {
Diff for main-aaf42c5..da572c9a8.js
@@ -710,17 +710,25 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                       return doRender(renderingProps);
 
                     case 7:
-                      _context2.next = 14;
+                      _context2.next = 16;
                       break;
 
                     case 9:
                       _context2.prev = 9;
                       _context2.t0 = _context2["catch"](4);
 
+                      if (!_context2.t0.cancelled) {
+                        _context2.next = 13;
+                        break;
+                      }
+
+                      throw _context2.t0;
+
+                    case 13:
                       if (false) {
                       }
 
-                      _context2.next = 14;
+                      _context2.next = 16;
                       return renderError(
                         (0, _extends2["default"])(
                           (0, _extends2["default"])({}, renderingProps),
@@ -731,7 +739,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
                         )
                       );
 
-                    case 14:
+                    case 16:
                     case "end":
                       return _context2.stop();
                   }
@@ -940,217 +948,181 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
         };
       };
 
-      function doRender(_x2) {
-        return _doRender.apply(this, arguments);
-      }
-
-      function _doRender() {
-        _doRender = _asyncToGenerator(
-          /*#__PURE__*/ _regeneratorRuntime.mark(function _callee3(_ref8) {
-            var App,
-              Component,
-              props,
-              err,
-              styleSheets,
-              appProps,
-              resolvePromise,
-              renderPromise,
-              onStart,
-              onAbort,
-              onCommit,
-              elem;
-            return _regeneratorRuntime.wrap(function _callee3$(_context3) {
-              while (1) {
-                switch ((_context3.prev = _context3.next)) {
-                  case 0:
-                    onCommit = function _onCommit() {
-                      if (
-                        // We can skip this during hydration. Running it wont cause any harm, but
-                        // we may as well save the CPU cycles.
-                        !isInitialRender && // We use `style-loader` in development, so we don't need to do anything
-                        // unless we're in production:
-                        true
-                      ) {
-                        // Remove old stylesheets:
-                        [].slice
-                          .call(document.querySelectorAll("link[data-n-p]"))
-                          .forEach(function(el) {
-                            return el.parentNode.removeChild(el);
-                          }); // Activate new stylesheets:
-                        [].slice
-                          .call(
-                            document.querySelectorAll("link[data-n-staging]")
-                          )
-                          .forEach(function(el) {
-                            el.removeAttribute("data-n-staging");
-                            el.removeAttribute("media");
-                            el.setAttribute("data-n-p", "");
-                          }); // Force browser to recompute layout, which prevents a flash of unstyled
-                        // content:
-
-                        getComputedStyle(document.body, "height");
-                      }
-
-                      resolvePromise();
-                    };
-
-                    onAbort = function _onAbort() {
-                      [].slice
-                        .call(document.querySelectorAll("link[data-n-staging]"))
-                        .forEach(function(el) {
-                          el.parentNode.removeChild(el);
-                        });
-                    };
-
-                    onStart = function _onStart() {
-                      if (
-                        // We can skip this during hydration. Running it wont cause any harm, but
-                        // we may as well save the CPU cycles.
-                        isInitialRender || // We use `style-loader` in development, so we don't need to do anything
-                        // unless we're in production:
-                        false
-                      ) {
-                        return Promise.resolve([]);
-                      }
-
-                      var referenceNode = [].slice
-                        .call(
-                          document.querySelectorAll(
-                            "link[data-n-g], link[data-n-p]"
-                          )
-                        )
-                        .pop();
-                      var required = styleSheets.map(function(href) {
-                        var _ref10 = (0, _pageLoader.createLink)(
-                            href,
-                            "stylesheet"
-                          ),
-                          _ref11 = _slicedToArray(_ref10, 2),
-                          link = _ref11[0],
-                          promise = _ref11[1];
-
-                        link.setAttribute("data-n-staging", ""); // Media `none` does not work in Firefox, so `print` is more
-                        // cross-browser. Since this is so short lived we don't have to worry
-                        // about style thrashing in a print view (where no routing is going to be
-                        // happening anyway).
-
-                        link.setAttribute("media", "print");
-
-                        if (referenceNode) {
-                          referenceNode.parentNode.insertBefore(
-                            link,
-                            referenceNode.nextSibling
-                          );
-                          referenceNode = link;
-                        } else {
-                          document.head.appendChild(link);
-                        }
+      function doRender(_ref8) {
+        var App = _ref8.App,
+          Component = _ref8.Component,
+          props = _ref8.props,
+          err = _ref8.err,
+          styleSheets = _ref8.styleSheets;
+        Component = Component || lastAppProps.Component;
+        props = props || lastAppProps.props;
+        var appProps = (0, _extends2["default"])(
+          (0, _extends2["default"])({}, props),
+          {},
+          {
+            Component: Component,
+            err: err,
+            router: router
+          }
+        ); // lastAppProps has to be set before ReactDom.render to account for ReactDom throwing an error.
+
+        lastAppProps = appProps;
+        var resolvePromise;
+        var renderPromiseReject;
+        var renderPromise = new Promise(function(resolve, reject) {
+          if (_lastRenderReject) {
+            _lastRenderReject();
+          }
 
-                        return promise;
-                      });
-                      return Promise.all(required)["catch"](function() {
-                        // This is too late in the rendering lifecycle to use the existing
-                        // `PAGE_LOAD_ERROR` flow (via `handleRouteInfoError`).
-                        // To match that behavior, we request the page to reload with the current
-                        // asPath. This is already set at this phase since we "committed" to the
-                        // render.
-                        // This handles an edge case where a new deployment is rolled during
-                        // client-side transition and the CSS assets are missing.
-                        // This prevents:
-                        //   1. An unstyled page from being rendered (old behavior)
-                        //   2. The `/_error` page being rendered (we want to reload for the new
-                        //      deployment)
-                        window.location.href = router.asPath; // Instead of rethrowing the CSS loading error, we give a promise that
-                        // won't resolve. This pauses the rendering process until the page
-                        // reloads. Re-throwing the error could result in a flash of error page.
-                        // throw cssLoadingError
-
-                        return new Promise(function() {});
-                      });
-                    };
-
-                    (App = _ref8.App),
-                      (Component = _ref8.Component),
-                      (props = _ref8.props),
-                      (err = _ref8.err),
-                      (styleSheets = _ref8.styleSheets);
-                    Component = Component || lastAppProps.Component;
-                    props = props || lastAppProps.props;
-                    appProps = (0, _extends2["default"])(
-                      (0, _extends2["default"])({}, props),
-                      {},
-                      {
-                        Component: Component,
-                        err: err,
-                        router: router
-                      }
-                    ); // lastAppProps has to be set before ReactDom.render to account for ReactDom throwing an error.
+          resolvePromise = function resolvePromise() {
+            _lastRenderReject = null;
+            resolve();
+          };
 
-                    lastAppProps = appProps;
-                    renderPromise = new Promise(function(resolve, reject) {
-                      if (_lastRenderReject) {
-                        _lastRenderReject();
-                      }
+          renderPromiseReject = _lastRenderReject = function lastRenderReject() {
+            _lastRenderReject = null;
+            var error = new Error("Cancel rendering route");
+            error.cancelled = true;
+            reject(error);
+          };
+        }); // TODO: consider replacing this with real `<style>` tags that have
+        // plain-text CSS content that's provided by RouteInfo. That'd remove the
+        // need for the staging `<link>`s and the ability for CSS to be missing at
+        // this phase, allowing us to remove the error handling flow that reloads the
+        // page.
+
+        function onStart() {
+          if (
+            // We can skip this during hydration. Running it wont cause any harm, but
+            // we may as well save the CPU cycles.
+            isInitialRender || // We use `style-loader` in development, so we don't need to do anything
+            // unless we're in production:
+            false
+          ) {
+            return Promise.resolve([]);
+          } // Clean up previous render if canceling:
 
-                      resolvePromise = function resolvePromise() {
-                        _lastRenderReject = null;
-                        resolve();
-                      };
+          [].slice
+            .call(document.querySelectorAll("link[data-n-staging]"))
+            .forEach(function(el) {
+              el.parentNode.removeChild(el);
+            });
+          var referenceNode = [].slice
+            .call(document.querySelectorAll("link[data-n-g], link[data-n-p]"))
+            .pop();
+          var required = styleSheets.map(function(href) {
+            var _ref9 = (0, _pageLoader.createLink)(href, "stylesheet"),
+              _ref10 = _slicedToArray(_ref9, 2),
+              link = _ref10[0],
+              promise = _ref10[1];
+
+            link.setAttribute("data-n-staging", ""); // Media `none` does not work in Firefox, so `print` is more
+            // cross-browser. Since this is so short lived we don't have to worry
+            // about style thrashing in a print view (where no routing is going to be
+            // happening anyway).
+
+            link.setAttribute("media", "print");
+
+            if (referenceNode) {
+              referenceNode.parentNode.insertBefore(
+                link,
+                referenceNode.nextSibling
+              );
+              referenceNode = link;
+            } else {
+              document.head.appendChild(link);
+            }
 
-                      _lastRenderReject = function lastRenderReject() {
-                        _lastRenderReject = null;
-                        reject();
-                      };
-                    }); // TODO: consider replacing this with real `<style>` tags that have
-                    // plain-text CSS content that's provided by RouteInfo. That'd remove the
-                    // need for the staging `<link>`s and the ability for CSS to be missing at
-                    // this phase, allowing us to remove the error handling flow that reloads the
-                    // page.
-
-                    renderPromise["catch"](function(abortError) {
-                      onAbort();
-                      throw abortError;
-                    });
-                    elem = /*#__PURE__*/ _react["default"].createElement(
-                      Root,
-                      {
-                        callback: onCommit
-                      },
-                      /*#__PURE__*/ _react["default"].createElement(
-                        AppContainer,
-                        null,
-                        /*#__PURE__*/ _react["default"].createElement(
-                          App,
-                          appProps
-                        )
-                      )
-                    ); // We catch runtime errors using componentDidCatch which will trigger renderError
+            return promise;
+          });
+          return Promise.all(required)["catch"](function() {
+            // This is too late in the rendering lifecycle to use the existing
+            // `PAGE_LOAD_ERROR` flow (via `handleRouteInfoError`).
+            // To match that behavior, we request the page to reload with the current
+            // asPath. This is already set at this phase since we "committed" to the
+            // render.
+            // This handles an edge case where a new deployment is rolled during
+            // client-side transition and the CSS assets are missing.
+            // This prevents:
+            //   1. An unstyled page from being rendered (old behavior)
+            //   2. The `/_error` page being rendered (we want to reload for the new
+            //      deployment)
+            window.location.href = router.asPath; // Instead of rethrowing the CSS loading error, we give a promise that
+            // won't resolve. This pauses the rendering process until the page
+            // reloads. Re-throwing the error could result in a flash of error page.
+            // throw cssLoadingError
+
+            return new Promise(function() {});
+          });
+        }
 
-                    _context3.next = 13;
-                    return onStart();
+        function onCommit() {
+          if (
+            // We can skip this during hydration. Running it wont cause any harm, but
+            // we may as well save the CPU cycles.
+            !isInitialRender && // We use `style-loader` in development, so we don't need to do anything
+            // unless we're in production:
+            true
+          ) {
+            // Remove old stylesheets:
+            [].slice
+              .call(document.querySelectorAll("link[data-n-p]"))
+              .forEach(function(el) {
+                return el.parentNode.removeChild(el);
+              }); // Activate new stylesheets:
+            [].slice
+              .call(document.querySelectorAll("link[data-n-staging]"))
+              .forEach(function(el) {
+                el.removeAttribute("data-n-staging");
+                el.removeAttribute("media");
+                el.setAttribute("data-n-p", "");
+              }); // Force browser to recompute layout, which prevents a flash of unstyled
+            // content:
+
+            getComputedStyle(document.body, "height");
+          }
 
-                  case 13:
-                    renderReactElement(
-                      false ? /*#__PURE__*/ undefined : elem,
-                      appElement
-                    );
-                    _context3.next = 16;
-                    return renderPromise;
+          resolvePromise();
+        }
 
-                  case 16:
-                  case "end":
-                    return _context3.stop();
-                }
+        var elem = /*#__PURE__*/ _react["default"].createElement(
+          Root,
+          {
+            callback: onCommit
+          },
+          /*#__PURE__*/ _react["default"].createElement(
+            AppContainer,
+            null,
+            /*#__PURE__*/ _react["default"].createElement(App, appProps)
+          )
+        ); // We catch runtime errors using componentDidCatch which will trigger renderError
+
+        return Promise.race([
+          // Download required CSS assets first:
+          onStart()
+            .then(function() {
+              // Ensure a new render has not been started:
+              if (renderPromiseReject === _lastRenderReject) {
+                // Queue rendering:
+                renderReactElement(
+                  false ? /*#__PURE__*/ undefined : elem,
+                  appElement
+                );
               }
-            }, _callee3);
-          })
-        );
-        return _doRender.apply(this, arguments);
+            })
+            .then(function() {
+              return (
+                // Wait for rendering to complete:
+                renderPromise
+              );
+            }), // Bail early on route cancelation (rejection):
+          renderPromise
+        ]);
       }
 
-      function Root(_ref9) {
-        var callback = _ref9.callback,
-          children = _ref9.children;
+      function Root(_ref11) {
+        var callback = _ref11.callback,
+          children = _ref11.children;
 
         // We use `useLayoutEffect` to guarantee the callback is executed
         // as soon as React flushes the update.
Diff for index.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-18bcd2a0cc7cca0ea33f.module.js"
+      href="/_next/static/chunks/main-6be3b40e84a0ef19bb63.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e757038339ef53dbeb92.module.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b468a46ee8da7b068233.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-aaf42c5c0e6da572c9a8.js"
+      src="/_next/static/chunks/main-d890e543626e630662b3.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-18bcd2a0cc7cca0ea33f.module.js"
+      src="/_next/static/chunks/main-6be3b40e84a0ef19bb63.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.65b1856febc630f20327.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.0d25e2803cd924f5943c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e757038339ef53dbeb92.module.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b468a46ee8da7b068233.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-18bcd2a0cc7cca0ea33f.module.js"
+      href="/_next/static/chunks/main-6be3b40e84a0ef19bb63.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e757038339ef53dbeb92.module.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b468a46ee8da7b068233.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -86,13 +86,13 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-aaf42c5c0e6da572c9a8.js"
+      src="/_next/static/chunks/main-d890e543626e630662b3.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-18bcd2a0cc7cca0ea33f.module.js"
+      src="/_next/static/chunks/main-6be3b40e84a0ef19bb63.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -122,13 +122,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.65b1856febc630f20327.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.0d25e2803cd924f5943c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e757038339ef53dbeb92.module.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b468a46ee8da7b068233.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/chunks/main-18bcd2a0cc7cca0ea33f.module.js"
+      href="/_next/static/chunks/main-6be3b40e84a0ef19bb63.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e757038339ef53dbeb92.module.js"
+      href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b468a46ee8da7b068233.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/chunks/polyfills-f73ba3fc145972ef83e9.js"
     ></script>
     <script
-      src="/_next/static/chunks/main-aaf42c5c0e6da572c9a8.js"
+      src="/_next/static/chunks/main-d890e543626e630662b3.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/main-18bcd2a0cc7cca0ea33f.module.js"
+      src="/_next/static/chunks/main-6be3b40e84a0ef19bb63.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.65b1856febc630f20327.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.0d25e2803cd924f5943c.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.e757038339ef53dbeb92.module.js"
+      src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.b468a46ee8da7b068233.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
buildDuration 11.7s 11.4s -278ms
nodeModulesSize 57.5 MB 57.5 MB ⚠️ +1.7 kB
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
677f882d2ed8..1962.js gzip 10.2 kB N/A N/A
framework.HASH.js gzip 39 kB 39 kB
main-3aeb17d..193e.js gzip 7.2 kB N/A N/A
webpack-e067..f178.js gzip 751 B 751 B
677f882d2ed8..07ae.js gzip N/A 10.3 kB N/A
main-bbb13a3..84ab.js gzip N/A 7.2 kB N/A
Overall change 57.2 kB 57.2 kB ⚠️ +15 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
677f882d2ed8..dule.js gzip 6.11 kB N/A N/A
framework.HA..dule.js gzip 39 kB 39 kB
main-e67bd4d..dule.js gzip 6.21 kB N/A N/A
webpack-07c5..dule.js gzip 751 B 751 B
677f882d2ed8..dule.js gzip N/A 6.12 kB N/A
main-fb79b83..dule.js gzip N/A 6.24 kB N/A
Overall change 52 kB 52.1 kB ⚠️ +48 B
Legacy Client Bundles (polyfills)
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-28298..e0c9.js gzip 3.44 kB 3.44 kB
hooks-89731c..c609.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-000f151..65d4.js gzip 1.29 kB 1.29 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.69 kB 7.69 kB
Client Pages Modern
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-65c8a..dule.js gzip 2.29 kB 2.29 kB
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-4cfda7a..dule.js gzip 1.26 kB 1.26 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.35 kB 5.35 kB
Client Build Manifests
vercel/next.js canary Timer/next.js hotfix/cancel-render Change
_buildManifest.js gzip 322 B 322 B
_buildManife..dule.js gzip 330 B 330 B
Overall change 652 B 652 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary Timer/next.js hotfix/cancel-render 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 ⚠️ +78 B
routerDirect.js 1.07 MB 1.07 MB ⚠️ +78 B
withRouter.js 1.07 MB 1.07 MB ⚠️ +78 B
Overall change 5.28 MB 5.28 MB ⚠️ +234 B
Commit: 36d4cde

@kodiakhq kodiakhq bot merged commit 9acd001 into vercel:canary Aug 22, 2020
@Timer Timer deleted the hotfix/cancel-render branch August 22, 2020 13:54
@maurocolella
Copy link

Thanks for that. I am currently seeing an issue that could be related, affecting IE11 on Windows (10) in dev mode:

Unhandled promise rejection Error: Cancel rendering route
   "Unhandled promise rejection"
   {
      [functions]: ,
      __proto__: { },
      cancelled: true,
      description: "Cancel rendering route",
      message: "Cancel rendering route",
      name: "Error",
      Symbol()_g.ovvoikoghym: undefined,
      Symbol(NextjsNodeError)_15.ovvoikoghy: undefined,
      Symbol(PAGE_LOAD_ERROR)_14.ovvoikoghy: undefined,
      Symbol(react.async_mode)_16.ovvoikoghy: undefined,
      Symbol(react.block)_10.ovvoikoghy: undefined,
      Symbol(react.concurrent_mode)_u.ovvoikoghym: undefined,
      Symbol(react.context)_t.ovvoikoghym: undefined,
      Symbol(react.element)_n.ovvoikoghym: undefined,
      Symbol(react.forward_ref)_v.ovvoikoghym: undefined,
      Symbol(react.fragment)_p.ovvoikoghym: undefined,
      Symbol(react.fundamental)_11.ovvoikoghy: undefined,
      Symbol(react.lazy)_z.ovvoikoghym: undefined,
      Symbol(react.memo)_y.ovvoikoghym: undefined,
      Symbol(react.portal)_o.ovvoikoghym: undefined,
      Symbol(react.profiler)_r.ovvoikoghym: undefined,
      Symbol(react.provider)_s.ovvoikoghym: undefined,
      Symbol(react.responder)_12.ovvoikoghy: undefined,
      Symbol(react.scope)_13.ovvoikoghy: undefined,
      Symbol(react.strict_mode)_q.ovvoikoghym: undefined,
      Symbol(react.suspense)_w.ovvoikoghym: undefined,
      Symbol(react.suspense_list)_x.ovvoikoghym: undefined
   }

I just did a clean reinstall of all modules, using the latest canary build of next.js.

{
  "name": "mauro-colella-fe",
  "version": "1.0.0",
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start",
    "type-check": "tsc"
  },
  "dependencies": {
    "@webcomponents/shadydom": "^1.7.4",
    "next": "^9.5.4-canary.23",
    "normalize.css": "^8.0.1",
    "pdf2json": "^1.2.0",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "sass": "^1.26.11",
    "simplex-noise": "^2.4.0"
  },
  "devDependencies": {
    "@types/node": "^14.10.1",
    "@types/react": "^16.9.49",
    "@types/react-dom": "^16.9.8",
    "typescript": "^4.0.2"
  },
  "license": "MIT"
}

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 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.

[experimental react] Next throws on cancelled renders

4 participants