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

Avoid adding basePath when it's not needed #14535

Merged
merged 5 commits into from
Jun 25, 2020
Merged

Conversation

anthonyshort
Copy link
Contributor

@anthonyshort anthonyshort commented Jun 24, 2020

Bug description

When using the basePath on pages with params it will fire a router change. This will pass the url pathname in the as param using the getUrl() function. When the app is mounted on a sub-path (which is the whole point of the basePath) the url will from window.location.href which will already include the base path.

What this means is that the as path will be sent through to the router already including the basePath, leading to /basePath/basePath/path which will cause the router to throw an error about mis-matched as and href params.

Reproduction

Here's a reproduction that uses nginx to route /sub/path to the Next app. The basePath is also set to /sub/path. It's not trying to do anything special other than rendering and grabbing the param using the router hook.

When using the `basePath` setting, on pages with params it will fire a router change. This will pass the url pathname in the `as` param using the `getUrl()` function. This means the `as` path will be sent through already including the `basePath`, leading to `/basePath/basePath/path` which will cause the router to throw an error.
@ijjk
Copy link
Member

ijjk commented Jun 24, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
buildDuration 13.2s 13s -181ms
nodeModulesSize 67.2 MB 67.2 MB ⚠️ +136 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
/ failed reqs 0 0
/ total time (seconds) 2.179 2.128 -0.05
/ avg req/sec 1147.29 1174.99 ⚠️ +27.7
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.255 1.297 ⚠️ +0.04
/error-in-render avg req/sec 1991.68 1927.2 -64.48
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
19b7e98f51cc..14a7.js gzip 10.7 kB 10.7 kB ⚠️ +5 B
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB ⚠️ +5 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.module.js gzip 5.57 kB 5.57 kB
webpack-HASH..dule.js gzip 746 B 746 B
19b7e98f51cc..dule.js gzip 7.07 kB 7.07 kB ⚠️ +2 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +2 B
Legacy Client Bundles (polyfills)
vercel/next.js canary anthonyshort/next.js patch-1 Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary anthonyshort/next.js patch-1 Change
_buildManifest.js gzip 267 B 267 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 539 B 539 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
index.html gzip 954 B 956 B ⚠️ +2 B
link.html gzip 962 B 961 B -1 B
withRouter.html gzip 947 B 948 B ⚠️ +1 B
Overall change 2.86 kB 2.87 kB ⚠️ +2 B

Diffs

Diff for 19b7e98f51cc..ae.module.js
@@ -669,7 +669,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       var basePath = false || "";
 
       function addBasePath(path) {
-        return "".concat(basePath).concat(path);
+        return path.startsWith(basePath)
+          ? path
+          : "".concat(basePath).concat(path);
       }
 
       function delBasePath(path) {
Diff for 19b7e98f51cc..2341fc613.js
@@ -799,7 +799,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       var basePath = false || "";
 
       function addBasePath(path) {
-        return "".concat(basePath).concat(path);
+        return path.startsWith(basePath)
+          ? path
+          : "".concat(basePath).concat(path);
       }
 
       function delBasePath(path) {
Diff for index.html
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.af0f7c24035cfb520019.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.84ae27d08f82341fc613.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.2fda4ad3d0d18300dcc2.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.af0f7c24035cfb520019.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.af0f7c24035cfb520019.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -122,13 +122,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.84ae27d08f82341fc613.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.2fda4ad3d0d18300dcc2.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.af0f7c24035cfb520019.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.af0f7c24035cfb520019.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.84ae27d08f82341fc613.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.2fda4ad3d0d18300dcc2.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.af0f7c24035cfb520019.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
buildDuration 14.1s 14s -37ms
nodeModulesSize 67.2 MB 67.2 MB ⚠️ +136 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
19b7e98f51cc..14a7.js gzip 10.7 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
19b7e98f51cc..566a.js gzip N/A 10.7 kB N/A
Overall change 57.1 kB 57.1 kB ⚠️ +5 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.module.js gzip 5.57 kB 5.57 kB
webpack-HASH..dule.js gzip 746 B 746 B
19b7e98f51cc..dule.js gzip 7.07 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
19b7e98f51cc..dule.js gzip N/A 7.07 kB N/A
Overall change 52.5 kB 52.5 kB ⚠️ +2 B
Legacy Client Bundles (polyfills)
vercel/next.js canary anthonyshort/next.js patch-1 Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary anthonyshort/next.js patch-1 Change
_buildManifest.js gzip 267 B 267 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 539 B 539 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB
link.js 916 kB 916 kB ⚠️ +35 B
routerDirect.js 908 kB 908 kB ⚠️ +35 B
withRouter.js 908 kB 908 kB ⚠️ +35 B
Overall change 4.49 MB 4.49 MB ⚠️ +105 B
Commit: 789e66b

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

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.

Thanks for the PR! I went ahead and added a test case to ensure we don't regress on this and also tweaked the fix a bit to ensure the behavior of delBasePath isn't changed and the other tests are still passing

@ijjk
Copy link
Member

ijjk commented Jun 25, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
buildDuration 10.3s 10.4s ⚠️ +106ms
nodeModulesSize 67.2 MB 67.2 MB ⚠️ +220 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
/ failed reqs 0 0
/ total time (seconds) 1.688 1.696 ⚠️ +0.01
/ avg req/sec 1481.26 1474.06 -7.2
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 0.986 1.004 ⚠️ +0.02
/error-in-render avg req/sec 2534.78 2490.57 -44.21
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.js gzip 6.49 kB 6.5 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
19b7e98f51cc..14a7.js gzip 10.7 kB 10.7 kB ⚠️ +2 B
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57.1 kB 57.1 kB ⚠️ +18 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.module.js gzip 5.57 kB 5.59 kB ⚠️ +20 B
webpack-HASH..dule.js gzip 746 B 746 B
19b7e98f51cc..dule.js gzip 7.07 kB 7.07 kB ⚠️ +2 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary anthonyshort/next.js patch-1 Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary anthonyshort/next.js patch-1 Change
_buildManifest.js gzip 267 B 267 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 539 B 539 B
Rendered Page Sizes
vercel/next.js canary anthonyshort/next.js patch-1 Change
index.html gzip 954 B 956 B ⚠️ +2 B
link.html gzip 962 B 960 B -2 B
withRouter.html gzip 947 B 947 B
Overall change 2.86 kB 2.86 kB

Diffs

Diff for 19b7e98f51cc..ae.module.js
@@ -912,7 +912,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   pathname: addBasePath(_pathname),
                   query: _query
                 }),
-                _as
+                addBasePath(_as)
               );
             }
Diff for 19b7e98f51cc..2341fc613.js
@@ -1051,7 +1051,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                   pathname: addBasePath(_pathname),
                   query: _query
                 }),
-                _as
+                addBasePath(_as)
               );
             }
Diff for main-HASH.js
@@ -273,6 +273,8 @@
 
       var _utils = __webpack_require__("g/15");
 
+      var _router2 = __webpack_require__("elyg");
+
       var _headManager = _interopRequireDefault(__webpack_require__("DqTX"));
 
       var _pageLoader = _interopRequireDefault(__webpack_require__("zmvN"));
@@ -313,7 +315,7 @@
         serverRuntimeConfig: {},
         publicRuntimeConfig: runtimeConfig || {}
       });
-      var asPath = (0, _utils.getURL)();
+      var asPath = (0, _router2.delBasePath)((0, _utils.getURL)());
       var pageLoader = new _pageLoader["default"](buildId, prefix, page);
 
       var register = function register(_ref) {
Diff for main-HASH.module.js
@@ -191,6 +191,8 @@
 
       var _utils = __webpack_require__("g/15");
 
+      var _router2 = __webpack_require__("elyg");
+
       var _headManager = _interopRequireDefault(__webpack_require__("DqTX"));
 
       var _pageLoader = _interopRequireDefault(__webpack_require__("zmvN"));
@@ -233,7 +235,7 @@
         serverRuntimeConfig: {},
         publicRuntimeConfig: runtimeConfig || {}
       });
-      var asPath = (0, _utils.getURL)();
+      var asPath = (0, _router2.delBasePath)((0, _utils.getURL)());
       var pageLoader = new _pageLoader.default(buildId, prefix, page);
 
       var register = _ref => {
Diff for index.html
@@ -6,7 +6,7 @@
     <meta name="next-head-count" content="2" />
     <link
       rel="preload"
-      href="/_next/static/runtime/main-44231f8dcc4c3aad570c.module.js"
+      href="/_next/static/runtime/main-19eb7ee5a14e78d5c3f0.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.6562b366da40ce1e34e8.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/runtime/polyfills-b9d354b83d10fbe21b38.js"
     ></script>
     <script
-      src="/_next/static/runtime/main-9bb13ca99cde7b5d3ad1.js"
+      src="/_next/static/runtime/main-f59fa8078161f9914786.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-44231f8dcc4c3aad570c.module.js"
+      src="/_next/static/runtime/main-19eb7ee5a14e78d5c3f0.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.84ae27d08f82341fc613.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.f1f4e02fdab29f2d0c89.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.6562b366da40ce1e34e8.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/runtime/main-44231f8dcc4c3aad570c.module.js"
+      href="/_next/static/runtime/main-19eb7ee5a14e78d5c3f0.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.6562b366da40ce1e34e8.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -86,13 +86,13 @@
       src="/_next/static/runtime/polyfills-b9d354b83d10fbe21b38.js"
     ></script>
     <script
-      src="/_next/static/runtime/main-9bb13ca99cde7b5d3ad1.js"
+      src="/_next/static/runtime/main-f59fa8078161f9914786.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-44231f8dcc4c3aad570c.module.js"
+      src="/_next/static/runtime/main-19eb7ee5a14e78d5c3f0.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -122,13 +122,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.84ae27d08f82341fc613.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.f1f4e02fdab29f2d0c89.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.6562b366da40ce1e34e8.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/runtime/main-44231f8dcc4c3aad570c.module.js"
+      href="/_next/static/runtime/main-19eb7ee5a14e78d5c3f0.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -24,7 +24,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      href="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.6562b366da40ce1e34e8.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -81,13 +81,13 @@
       src="/_next/static/runtime/polyfills-b9d354b83d10fbe21b38.js"
     ></script>
     <script
-      src="/_next/static/runtime/main-9bb13ca99cde7b5d3ad1.js"
+      src="/_next/static/runtime/main-f59fa8078161f9914786.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/runtime/main-44231f8dcc4c3aad570c.module.js"
+      src="/_next/static/runtime/main-19eb7ee5a14e78d5c3f0.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
@@ -117,13 +117,13 @@
       type="module"
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.84ae27d08f82341fc613.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.f1f4e02fdab29f2d0c89.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script>
     <script
-      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.49eb0f00d05cbc3d1aae.module.js"
+      src="/_next/static/chunks/19b7e98f51cc0d86c45d01159bbbfb942bfe49b8.6562b366da40ce1e34e8.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
buildDuration 11s 11.1s ⚠️ +76ms
nodeModulesSize 67.2 MB 67.2 MB ⚠️ +220 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.js gzip 6.49 kB 6.5 kB ⚠️ +16 B
webpack-HASH.js gzip 746 B 746 B
19b7e98f51cc..14a7.js gzip 10.7 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
19b7e98f51cc..834a.js gzip N/A 10.7 kB N/A
Overall change 57.1 kB 57.1 kB ⚠️ +18 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary anthonyshort/next.js patch-1 Change
main-HASH.module.js gzip 5.57 kB 5.59 kB ⚠️ +20 B
webpack-HASH..dule.js gzip 746 B 746 B
19b7e98f51cc..dule.js gzip 7.07 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
19b7e98f51cc..dule.js gzip N/A 7.07 kB N/A
Overall change 52.5 kB 52.5 kB ⚠️ +22 B
Legacy Client Bundles (polyfills)
vercel/next.js canary anthonyshort/next.js patch-1 Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Build Manifests
vercel/next.js canary anthonyshort/next.js patch-1 Change
_buildManifest.js gzip 267 B 267 B
_buildManife..dule.js gzip 272 B 272 B
Overall change 539 B 539 B
Serverless bundles
vercel/next.js canary anthonyshort/next.js patch-1 Change
_error.js 875 kB 875 kB
404.html 4.17 kB 4.17 kB
hooks.html 3.79 kB 3.79 kB
index.js 876 kB 876 kB
link.js 916 kB 916 kB
routerDirect.js 908 kB 908 kB
withRouter.js 908 kB 908 kB
Overall change 4.49 MB 4.49 MB
Commit: b954f86

@ijjk ijjk merged commit 61c4cdb into vercel:canary Jun 25, 2020
@anthonyshort
Copy link
Contributor Author

Great! Thanks for wrapping this up for me 👍🏻

@anthonyshort anthonyshort deleted the patch-1 branch June 25, 2020 19:28
rokinsky pushed a commit to rokinsky/next.js that referenced this pull request Jul 11, 2020
* Avoid adding basePath when it's not needed

When using the `basePath` setting, on pages with params it will fire a router change. This will pass the url pathname in the `as` param using the `getUrl()` function. This means the `as` path will be sent through already including the `basePath`, leading to `/basePath/basePath/path` which will cause the router to throw an error.

* lint

* Add test case and ensure removal

* Make sure to re-add before changeState

Co-authored-by: JJ Kasper <[email protected]>
@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.

2 participants