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

Allow mismatching href and as when manually provided #9837

Merged
merged 11 commits into from Jan 20, 2020

Conversation

ijjk
Copy link
Member

@ijjk ijjk commented Dec 26, 2019

This allows a mismatching href and as value when the params are manually provided in the href's query. This mismatching can occur when you are using the new experimental custom-routes feature and you are rewriting to a dynamic route

We currently aren't able to parse the params automatically since we don't ship the custom-routes to the client so we can't find where the as value is pointing to client-side

x-ref: #9700 (comment)

@ijjk ijjk added this to the 9.2.0 milestone Dec 26, 2019
@ijjk
Copy link
Member Author

ijjk commented Dec 26, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.7s 13.7s ⚠️ +6ms
nodeModulesSize 49 MB 49 MB ⚠️ +720 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..ffd6ec090.js N/A 38.1 kB N/A
de003c3a9d30..c090.js gzip N/A 13.8 kB N/A
Overall change 206 kB 206 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..d5.module.js N/A 33 kB N/A
de003c3a9d30..dule.js gzip N/A 12.4 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.03 kB 1.04 kB ⚠️ +3 B
link.html 4.11 kB 4.11 kB
link.html gzip 1.04 kB 1.04 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB
Overall change 12.3 kB 12.3 kB

Diffs

Diff for index.html
@@ -18,7 +18,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -58,9 +58,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.44e469766c71b4cff35f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/BUILD_ID/_buildManifest.js" async=""
         crossorigin="anonymous" nomodule=""></script>
Diff for link.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-c23131b468855e60026c.module.js"
         as="script" crossorigin="anonymous" />
@@ -57,9 +57,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.44e469766c71b4cff35f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-2e3344166bae5d9145c8.js"
         async="" crossorigin="anonymous" nomodule=""></script>
Diff for withRouter.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-c23131b468855e60026c.module.js"
         as="script" crossorigin="anonymous" />
@@ -55,9 +55,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.44e469766c71b4cff35f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-2e3344166bae5d9145c8.js"
         async="" crossorigin="anonymous" nomodule=""></script>

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 14.3s 14s -315ms
nodeModulesSize 49 MB 49 MB ⚠️ +720 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..ffd6ec090.js N/A 38.1 kB N/A
de003c3a9d30..c090.js gzip N/A 13.8 kB N/A
Overall change 206 kB 206 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..d5.module.js N/A 33 kB N/A
de003c3a9d30..dule.js gzip N/A 12.4 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles Overall decrease ✓
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_error.js 299 kB 299 kB -159 B
_error.js gzip 78.8 kB 78.8 kB -75 B
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB ⚠️ +1 B
index.js 299 kB 298 kB -159 B
index.js gzip 79.1 kB 79 kB -77 B
link.js 306 kB 306 kB -159 B
link.js gzip 81.1 kB 81.1 kB -75 B
routerDirect.js 299 kB 299 kB -159 B
routerDirect.js gzip 79.1 kB 79 kB -77 B
withRouter.js 299 kB 299 kB -159 B
withRouter.js gzip 79.3 kB 79.2 kB -76 B
Overall change 1.51 MB 1.51 MB -795 B

Commit: e98b5d1

@ijjk
Copy link
Member Author

ijjk commented Dec 26, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.5s 13.7s ⚠️ +129ms
nodeModulesSize 49 MB 49 MB ⚠️ +720 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..ffd6ec090.js N/A 38.1 kB N/A
de003c3a9d30..c090.js gzip N/A 13.8 kB N/A
Overall change 206 kB 206 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..d5.module.js N/A 33 kB N/A
de003c3a9d30..dule.js gzip N/A 12.4 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Rendered Page Sizes
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.03 kB 1.04 kB ⚠️ +3 B
link.html 4.11 kB 4.11 kB
link.html gzip 1.04 kB 1.04 kB
withRouter.html 4.12 kB 4.12 kB
withRouter.html gzip 1.03 kB 1.03 kB
Overall change 12.3 kB 12.3 kB

Diffs

Diff for index.html
@@ -18,7 +18,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         as="script" crossorigin="anonymous" />
     </head>
     
@@ -58,9 +58,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.44e469766c71b4cff35f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/BUILD_ID/_buildManifest.js" async=""
         crossorigin="anonymous" nomodule=""></script>
Diff for link.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-c23131b468855e60026c.module.js"
         as="script" crossorigin="anonymous" />
@@ -57,9 +57,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.44e469766c71b4cff35f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-2e3344166bae5d9145c8.js"
         async="" crossorigin="anonymous" nomodule=""></script>
Diff for withRouter.html
@@ -16,7 +16,7 @@
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         as="script" crossorigin="anonymous" />
-        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <link rel="preload" href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         as="script" crossorigin="anonymous" />
         <link rel="preload" href="/_next/static/runtime/main-c23131b468855e60026c.module.js"
         as="script" crossorigin="anonymous" />
@@ -55,9 +55,9 @@
         async="" crossorigin="anonymous" nomodule=""></script>
         <script src="/_next/static/chunks/4952ddcd88e7185e66c9cf40e2d848b7e27f1574.6406830adfd759a39616.module.js"
         async="" crossorigin="anonymous" type="module"></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.48a2d28f0c3bd751be36.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.44e469766c71b4cff35f.js"
         async="" crossorigin="anonymous" nomodule=""></script>
-        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bdb1895cb5ac008f5797.module.js"
+        <script src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.bab7e1cc7f6cc45485e8.module.js"
         async="" crossorigin="anonymous" type="module"></script>
         <script src="/_next/static/runtime/main-2e3344166bae5d9145c8.js"
         async="" crossorigin="anonymous" nomodule=""></script>

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.8s 13.7s -76ms
nodeModulesSize 49 MB 49 MB ⚠️ +720 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js 18.2 kB 18.2 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..1db6754d3.js 12 kB 12 kB
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js 10.9 kB 10.9 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..17cdc0d60.js 38.3 kB N/A N/A
de003c3a9d30..0d60.js gzip 13.9 kB N/A N/A
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
de003c3a9d30..ffd6ec090.js N/A 38.1 kB N/A
de003c3a9d30..c090.js gzip N/A 13.8 kB N/A
Overall change 206 kB 206 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js 14.4 kB 14.4 kB
main-HASH.module.js gzip 5.42 kB 5.42 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..b9.module.js 14.9 kB 14.9 kB
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..e3.module.js 33.1 kB N/A N/A
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
de003c3a9d30..d5.module.js N/A 33 kB N/A
de003c3a9d30..dule.js gzip N/A 12.4 kB N/A
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js 2.94 kB 2.94 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 10.4 kB 10.4 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js 1.44 kB 1.44 kB
hooks.js gzip 779 B 779 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.88 kB 6.88 kB
link.js gzip 2.93 kB 2.93 kB
routerDirect.js 411 B 411 B
routerDirect.js gzip 283 B 283 B
withRouter.js 421 B 421 B
withRouter.js gzip 282 B 282 B
Overall change 22.8 kB 22.8 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 757 B 757 B
_error.module.js 7.35 kB 7.35 kB
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.54 kB 5.54 kB
link.module.js gzip 2.49 kB 2.49 kB
routerDirect.module.js 383 B 383 B
routerDirect..dule.js gzip 273 B 273 B
withRouter.module.js 394 B 394 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js 81 B 81 B
_buildManifest.js gzip 61 B 61 B
_buildManifest.module.js 81 B 81 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 162 B 162 B
Serverless bundles Overall decrease ✓
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_error.js 299 kB 299 kB -159 B
_error.js gzip 78.8 kB 78.8 kB -75 B
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB ⚠️ +1 B
index.js 299 kB 298 kB -159 B
index.js gzip 79.1 kB 79 kB -77 B
link.js 306 kB 306 kB -159 B
link.js gzip 81.1 kB 81.1 kB -75 B
routerDirect.js 299 kB 299 kB -159 B
routerDirect.js gzip 79.1 kB 79 kB -77 B
withRouter.js 299 kB 299 kB -159 B
withRouter.js gzip 79.3 kB 79.2 kB -76 B
Overall change 1.51 MB 1.51 MB -795 B

Commit: a96c9eb

@Timer Timer modified the milestones: 9.2.0, 9.2.x Jan 3, 2020
@rscotten
Copy link
Contributor

rscotten commented Jan 8, 2020

@ijjk Great work on this.
@Timer @timneutkens @lfades, pinging you for input

tldr; Can we add the query params supplied to href to the route.pathname, i.e. make them equivalent?

I'm currently using the solution in this PR to create an Instagram style modal, and it's working well.

I noticed that when logging the router prop to the console, the pathname and route fields are the same. Are they always the same? And could we make the pathname equal to the provided href with the newly added query parameters?

For example, for this Link

  const productId = "123";
  const vendor = "abc-store";
  //...
  <Link
    href={`/[vendor]/products?vendor=${vendor}&productId=${productId}`}
    as={`/${vendor}/products/${productId}`}
    shallow
  >
    Click me
  </Link>

the router object would be

  {
    route: "/[vendor]/products",
    // add the query params to pathname as shown below
    pathname: "/[vendor]/products?productId=123&vendor=abc-store", 
    query: { 
      productId: "123", 
      vendor: "abc-store"
    },
    asPath: "/abc-store/products/123"
    // ...
  }  

This would be helpful in implementing things like a modal carousel for various resources, meaning I could easily re-use the carousel for /[vendor]/products and /[vendor]/orders. All that's needed to get the next or previous route would be to replace the current resource ID (e.g. productId or orderId) with the next or previous resource ID, e.g.

  // this way I don't need to know if the query param is `productId` or `orderId`
  const goToNextUrl = (router: Router, currentId: string, nextId: string) => {
    // let's say the router.pathname is /[vendor]/products?vendor=abc-store&productId=123
    // and currentId is 123 and nextId is 456
    const url = router.pathname.replace(currentId, nextId); // -> /[vendor]/products?vendor=abc-store&productId=456
    const as = router.asPath.replace(currentId, nextId); // -> /abc-store/products/456
    router.push(url, as, {shallow: true});
  }

What do you think?

@rscotten
Copy link
Contributor

rscotten commented Jan 9, 2020

As it stands now, I have to add the stringified query params, which is not that pretty:

import queryString from 'query-string';

const goToNextUrl = (router: Router, currentId: string, nextId: string) => {
  const url = router.pathname + '?' + queryString.stringify(router.query).replace(currentId, nextId);
  const as = router.asPath.replace(currentId, nextId);
  router.push(url, as, { shallow: true });
}

@rscotten
Copy link
Contributor

rscotten commented Jan 9, 2020

Got another use case. Consider a modal with tabs, and you want to navigate to a tab within the modal by updating the url hash. You have to append the stringified query params again:

  router.push(
    pathname: router.pathname + '?' + queryString.stringify(router.query),
    pathname: router.asPath + '#more',
    { shallow: true}
  );

@rscotten
Copy link
Contributor

rscotten commented Jan 9, 2020

Well, I suppose I could use window.history.state.url in lieu of router.pathname + '?' + queryString.stringify(router.query).

This would probably not be obvious to a beginner or anyone unfamiliar with how the NextJS router leverages the History API.

@czebe
Copy link

czebe commented Jan 15, 2020

We're also facing this issue:

  • our app is under a /public folder due to infrastructure security reasons (not to expose health endpoints)
  • routing is done by a proxy

The resulting regex match becomes invalid:
(/^\/public\/processing\/([^\/]+?)(?:\/)?$/i).exec('/batch/processing/3');

  • pathname: /public/processing/[id]
  • as: /batch/processing/3

packages/next/next-server/lib/router/router.ts Outdated Show resolved Hide resolved
packages/next/next-server/lib/router/router.ts Outdated Show resolved Hide resolved
@ijjk
Copy link
Member Author

ijjk commented Jan 17, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.4s 12.8s -647ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +524 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.1 kB 5.1 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..e54b.js gzip 13.7 kB 13.8 kB ⚠️ +78 B
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 67.4 kB 67.5 kB ⚠️ +78 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.16 kB 4.16 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.6 kB ⚠️ +98 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 62.1 kB 62.2 kB ⚠️ +98 B
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.33 kB 1.33 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 757 B 757 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.41 kB 7.41 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes Overall decrease ✓
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
index.html gzip 1.02 kB 1.02 kB -1 B
link.html gzip 1.03 kB 1.03 kB -2 B
withRouter.html gzip 1.01 kB 1.01 kB
Overall change 3.07 kB 3.06 kB -3 B

Diffs

Diff for de003c3a9d30..e4.module.js
@@ -1759,6 +1759,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
     /***/ elyg: /***/ function(module, exports, __webpack_require__) {
       'use strict'
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -2080,29 +2082,38 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
             if (is_dynamic_1.isDynamicRoute(route)) {
               var { pathname: asPathname } = url_1.parse(as)
-              var routeMatch = route_matcher_1.getRouteMatcher(
-                route_regex_1.getRouteRegex(route)
-              )(asPathname)
+              var routeRegex = route_regex_1.getRouteRegex(route)
+              var routeMatch = route_matcher_1.getRouteMatcher(routeRegex)(
+                asPathname
+              )
 
               if (!routeMatch) {
-                var error =
-                  'The provided `as` value ('
-                    .concat(
-                      asPathname,
-                      ') is incompatible with the `href` value ('
-                    )
-                    .concat(route, '). ') +
-                  'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                var missingParams = _Object$keys(routeRegex.groups).filter(
+                  param => !query[param]
+                )
 
-                if (false) {
-                } else {
-                  console.error(error)
+                if (missingParams.length > 0) {
+                  console.warn(
+                    'Mismatching `as` and `href` failed to manually provide ' +
+                      'the params: '.concat(
+                        missingParams.join(', '),
+                        " in the `href`'s `query`"
+                      )
+                  )
+                  throw new Error(
+                    'The provided `as` value ('
+                      .concat(
+                        asPathname,
+                        ') is incompatible with the `href` value ('
+                      )
+                      .concat(route, '). ') +
+                      'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                  )
                 }
-
-                return resolve(false)
-              } // Merge params into `query`, overwriting any specified in search
-
-              _Object$assign(query, routeMatch)
+              } else {
+                // Merge params into `query`, overwriting any specified in search
+                _Object$assign(query, routeMatch)
+              }
             }
 
             Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for de003c3a9d30..0b02858bf.js
@@ -1410,6 +1410,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
       var _slicedToArray = __webpack_require__('8+Nu')
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -1769,29 +1771,40 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       var _url_1$parse2 = url_1.parse(as),
                         asPathname = _url_1$parse2.pathname
 
+                      var routeRegex = route_regex_1.getRouteRegex(route)
                       var routeMatch = route_matcher_1.getRouteMatcher(
-                        route_regex_1.getRouteRegex(route)
+                        routeRegex
                       )(asPathname)
 
                       if (!routeMatch) {
-                        var error =
-                          'The provided `as` value ('
-                            .concat(
-                              asPathname,
-                              ') is incompatible with the `href` value ('
-                            )
-                            .concat(route, '). ') +
-                          'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                        var missingParams = _Object$keys(
+                          routeRegex.groups
+                        ).filter(function(param) {
+                          return !query[param]
+                        })
 
-                        if (false) {
-                        } else {
-                          console.error(error)
+                        if (missingParams.length > 0) {
+                          console.warn(
+                            'Mismatching `as` and `href` failed to manually provide ' +
+                              'the params: '.concat(
+                                missingParams.join(', '),
+                                " in the `href`'s `query`"
+                              )
+                          )
+                          throw new Error(
+                            'The provided `as` value ('
+                              .concat(
+                                asPathname,
+                                ') is incompatible with the `href` value ('
+                              )
+                              .concat(route, '). ') +
+                              'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                          )
                         }
-
-                        return resolve(false)
-                      } // Merge params into `query`, overwriting any specified in search
-
-                      _Object$assign(query, routeMatch)
+                      } else {
+                        // Merge params into `query`, overwriting any specified in search
+                        _Object$assign(query, routeMatch)
+                      }
                     }
 
                     Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for index.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.39df45a904f838d153a8.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e00b2f1beee9eedc9375.js"
       defer=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.39df45a904f838d153a8.module.js"
       defer=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.39df45a904f838d153a8.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -156,13 +156,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e00b2f1beee9eedc9375.js"
       defer=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.39df45a904f838d153a8.module.js"
       defer=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.39df45a904f838d153a8.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e00b2f1beee9eedc9375.js"
       defer=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.39df45a904f838d153a8.module.js"
       defer=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.3s 13.8s ⚠️ +496ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +524 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.1 kB 5.1 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..e54b.js gzip 13.7 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
de003c3a9d30..8509.js gzip N/A 13.8 kB N/A
Overall change 67.4 kB 67.5 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.16 kB 4.16 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 62.1 kB 62.2 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.33 kB 1.33 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 757 B 757 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.41 kB 7.41 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_error.js gzip 77.9 kB 78.1 kB ⚠️ +111 B
hooks.html gzip 1.05 kB 1.05 kB ⚠️ +1 B
index.js gzip 78.1 kB 78.3 kB ⚠️ +114 B
link.js gzip 80.6 kB 80.7 kB ⚠️ +101 B
routerDirect.js gzip 78.2 kB 78.4 kB ⚠️ +112 B
withRouter.js gzip 78.3 kB 78.4 kB ⚠️ +113 B
Overall change 394 kB 395 kB ⚠️ +552 B

Commit: b97b955

@ijjk ijjk requested a review from Timer January 17, 2020 01:39
Copy link
Member

@Timer Timer left a comment

Choose a reason for hiding this comment

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

Can we test that /_error gets rendered in prod? Or does it not in this circumstance?

@ijjk
Copy link
Member Author

ijjk commented Jan 17, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.5s 13.7s ⚠️ +177ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +576 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.1 kB 5.1 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..e54b.js gzip 13.7 kB 13.8 kB ⚠️ +83 B
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 67.4 kB 67.5 kB ⚠️ +83 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.16 kB 4.16 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.6 kB ⚠️ +100 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 62.1 kB 62.2 kB ⚠️ +100 B
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.33 kB 1.33 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 757 B 757 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.41 kB 7.41 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes Overall decrease ✓
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
index.html gzip 1.02 kB 1.02 kB -3 B
link.html gzip 1.03 kB 1.03 kB -1 B
withRouter.html gzip 1.01 kB 1.01 kB
Overall change 3.07 kB 3.06 kB -4 B

Diffs

Diff for de003c3a9d30..e4.module.js
@@ -1759,6 +1759,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
     /***/ elyg: /***/ function(module, exports, __webpack_require__) {
       'use strict'
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -2080,29 +2082,40 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
             if (is_dynamic_1.isDynamicRoute(route)) {
               var { pathname: asPathname } = url_1.parse(as)
-              var routeMatch = route_matcher_1.getRouteMatcher(
-                route_regex_1.getRouteRegex(route)
-              )(asPathname)
+              var routeRegex = route_regex_1.getRouteRegex(route)
+              var routeMatch = route_matcher_1.getRouteMatcher(routeRegex)(
+                asPathname
+              )
 
               if (!routeMatch) {
-                var error =
-                  'The provided `as` value ('
-                    .concat(
-                      asPathname,
-                      ') is incompatible with the `href` value ('
-                    )
-                    .concat(route, '). ') +
-                  'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                var missingParams = _Object$keys(routeRegex.groups).filter(
+                  param => !query[param]
+                )
 
-                if (false) {
-                } else {
-                  console.error(error)
+                if (missingParams.length > 0) {
+                  console.warn(
+                    'Mismatching `as` and `href` failed to manually provide ' +
+                      'the params: '.concat(
+                        missingParams.join(', '),
+                        " in the `href`'s `query`"
+                      )
+                  )
+                  return reject(
+                    new Error(
+                      'The provided `as` value ('
+                        .concat(
+                          asPathname,
+                          ') is incompatible with the `href` value ('
+                        )
+                        .concat(route, '). ') +
+                        'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                    )
+                  )
                 }
-
-                return resolve(false)
-              } // Merge params into `query`, overwriting any specified in search
-
-              _Object$assign(query, routeMatch)
+              } else {
+                // Merge params into `query`, overwriting any specified in search
+                _Object$assign(query, routeMatch)
+              }
             }
 
             Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for de003c3a9d30..0b02858bf.js
@@ -1410,6 +1410,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
       var _slicedToArray = __webpack_require__('8+Nu')
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -1769,29 +1771,42 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       var _url_1$parse2 = url_1.parse(as),
                         asPathname = _url_1$parse2.pathname
 
+                      var routeRegex = route_regex_1.getRouteRegex(route)
                       var routeMatch = route_matcher_1.getRouteMatcher(
-                        route_regex_1.getRouteRegex(route)
+                        routeRegex
                       )(asPathname)
 
                       if (!routeMatch) {
-                        var error =
-                          'The provided `as` value ('
-                            .concat(
-                              asPathname,
-                              ') is incompatible with the `href` value ('
-                            )
-                            .concat(route, '). ') +
-                          'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                        var missingParams = _Object$keys(
+                          routeRegex.groups
+                        ).filter(function(param) {
+                          return !query[param]
+                        })
 
-                        if (false) {
-                        } else {
-                          console.error(error)
+                        if (missingParams.length > 0) {
+                          console.warn(
+                            'Mismatching `as` and `href` failed to manually provide ' +
+                              'the params: '.concat(
+                                missingParams.join(', '),
+                                " in the `href`'s `query`"
+                              )
+                          )
+                          return reject(
+                            new Error(
+                              'The provided `as` value ('
+                                .concat(
+                                  asPathname,
+                                  ') is incompatible with the `href` value ('
+                                )
+                                .concat(route, '). ') +
+                                'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                            )
+                          )
                         }
-
-                        return resolve(false)
-                      } // Merge params into `query`, overwriting any specified in search
-
-                      _Object$assign(query, routeMatch)
+                      } else {
+                        // Merge params into `query`, overwriting any specified in search
+                        _Object$assign(query, routeMatch)
+                      }
                     }
 
                     Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for index.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.a3b15e4bce4a643a0a0a.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.16dd10c650fc1cbe3dc4.js"
       defer=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.a3b15e4bce4a643a0a0a.module.js"
       defer=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.a3b15e4bce4a643a0a0a.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -156,13 +156,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.16dd10c650fc1cbe3dc4.js"
       defer=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.a3b15e4bce4a643a0a0a.module.js"
       defer=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.a3b15e4bce4a643a0a0a.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.f292cf66b770b02858bf.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.16dd10c650fc1cbe3dc4.js"
       defer=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c5cfe57ad45f291e53e4.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.a3b15e4bce4a643a0a0a.module.js"
       defer=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 14.2s 14.3s ⚠️ +87ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +576 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.1 kB 5.1 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..e54b.js gzip 13.7 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
de003c3a9d30..a35a.js gzip N/A 13.8 kB N/A
Overall change 67.4 kB 67.5 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.16 kB 4.16 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 12.5 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
de003c3a9d30..dule.js gzip N/A 12.6 kB N/A
Overall change 62.1 kB 62.2 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.33 kB 1.33 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 757 B 757 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.41 kB 7.41 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_error.js gzip 77.9 kB 78.1 kB ⚠️ +119 B
hooks.html gzip 1.05 kB 1.05 kB ⚠️ +1 B
index.js gzip 78.1 kB 78.3 kB ⚠️ +121 B
link.js gzip 80.6 kB 80.7 kB ⚠️ +109 B
routerDirect.js gzip 78.2 kB 78.4 kB ⚠️ +120 B
withRouter.js gzip 78.3 kB 78.4 kB ⚠️ +120 B
Overall change 394 kB 395 kB ⚠️ +590 B

Commit: 10aaa7c

@ijjk
Copy link
Member Author

ijjk commented Jan 17, 2020

/_error isn't rendered in this case as it's an unhandled rejection in next/link. I added a test to reflect this

@ijjk ijjk requested review from Timer January 20, 2020 22:36
@Timer Timer modified the milestones: 9.2.x, 9.2.1 Jan 20, 2020
@ijjk
Copy link
Member Author

ijjk commented Jan 20, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 12.6s 12.5s -136ms
nodeModulesSize 48.8 MB 48.8 MB ⚠️ +762 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.12 kB 5.12 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..c512.js gzip 16.3 kB 16.3 kB ⚠️ +22 B
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 70 kB 70 kB ⚠️ +22 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 15.1 kB 15.1 kB ⚠️ +23 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 64.7 kB 64.7 kB ⚠️ +23 B
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
index.html gzip 1.02 kB 1.02 kB ⚠️ +1 B
link.html gzip 1.03 kB 1.03 kB ⚠️ +1 B
withRouter.html gzip 1.02 kB 1.02 kB
Overall change 3.07 kB 3.07 kB ⚠️ +2 B

Diffs

Diff for de003c3a9d30..a8.module.js
@@ -2906,6 +2906,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
     /***/ elyg: /***/ function(module, exports, __webpack_require__) {
       'use strict'
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -3229,29 +3231,36 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
             if (is_dynamic_1.isDynamicRoute(route)) {
               var { pathname: asPathname } = url_1.parse(as)
-              var routeMatch = route_matcher_1.getRouteMatcher(
-                route_regex_1.getRouteRegex(route)
-              )(asPathname)
+              var routeRegex = route_regex_1.getRouteRegex(route)
+              var routeMatch = route_matcher_1.getRouteMatcher(routeRegex)(
+                asPathname
+              )
 
               if (!routeMatch) {
-                var error =
-                  'The provided `as` value ('
-                    .concat(
-                      asPathname,
-                      ') is incompatible with the `href` value ('
-                    )
-                    .concat(route, '). ') +
-                  'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
-
-                if (false) {
-                } else {
-                  console.error(error)
-                }
+                var missingParams = _Object$keys(routeRegex.groups).filter(
+                  param => !query[param]
+                )
 
-                return resolve(false)
-              } // Merge params into `query`, overwriting any specified in search
+                if (missingParams.length > 0) {
+                  if (false) {
+                  }
 
-              _Object$assign(query, routeMatch)
+                  return reject(
+                    new Error(
+                      'The provided `as` value ('
+                        .concat(
+                          asPathname,
+                          ') is incompatible with the `href` value ('
+                        )
+                        .concat(route, '). ') +
+                        'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                    )
+                  )
+                }
+              } else {
+                // Merge params into `query`, overwriting any specified in search
+                _Object$assign(query, routeMatch)
+              }
             }
 
             Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for de003c3a9d30..b35e11fb4.js
@@ -2557,6 +2557,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
       var _slicedToArray = __webpack_require__('8+Nu')
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -2918,29 +2920,38 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       var _url_1$parse2 = url_1.parse(as),
                         asPathname = _url_1$parse2.pathname
 
+                      var routeRegex = route_regex_1.getRouteRegex(route)
                       var routeMatch = route_matcher_1.getRouteMatcher(
-                        route_regex_1.getRouteRegex(route)
+                        routeRegex
                       )(asPathname)
 
                       if (!routeMatch) {
-                        var error =
-                          'The provided `as` value ('
-                            .concat(
-                              asPathname,
-                              ') is incompatible with the `href` value ('
-                            )
-                            .concat(route, '). ') +
-                          'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                        var missingParams = _Object$keys(
+                          routeRegex.groups
+                        ).filter(function(param) {
+                          return !query[param]
+                        })
 
-                        if (false) {
-                        } else {
-                          console.error(error)
+                        if (missingParams.length > 0) {
+                          if (false) {
+                          }
+
+                          return reject(
+                            new Error(
+                              'The provided `as` value ('
+                                .concat(
+                                  asPathname,
+                                  ') is incompatible with the `href` value ('
+                                )
+                                .concat(route, '). ') +
+                                'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                            )
+                          )
                         }
-
-                        return resolve(false)
-                      } // Merge params into `query`, overwriting any specified in search
-
-                      _Object$assign(query, routeMatch)
+                      } else {
+                        // Merge params into `query`, overwriting any specified in search
+                        _Object$assign(query, routeMatch)
+                      }
                     }
 
                     Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for index.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.9d13a4f99d1b35e11fb4.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e3187ecbc67463c50cda.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -156,13 +156,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.9d13a4f99d1b35e11fb4.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e3187ecbc67463c50cda.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.9d13a4f99d1b35e11fb4.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e3187ecbc67463c50cda.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.3s 13.5s ⚠️ +175ms
nodeModulesSize 48.8 MB 48.8 MB ⚠️ +762 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.12 kB 5.12 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..c512.js gzip 16.3 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
de003c3a9d30..4d1d.js gzip N/A 16.3 kB N/A
Overall change 70 kB 70 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 15.1 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
de003c3a9d30..dule.js gzip N/A 15.1 kB N/A
Overall change 64.7 kB 64.7 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_error.js gzip 70.9 kB 70.9 kB -2 B
hooks.html gzip 1.06 kB 1.06 kB
index.js gzip 71.3 kB 71.3 kB
link.js gzip 80.6 kB 80.6 kB ⚠️ +52 B
routerDirect.js gzip 78.2 kB 78.3 kB ⚠️ +60 B
withRouter.js gzip 78.3 kB 78.3 kB ⚠️ +60 B
Overall change 380 kB 381 kB ⚠️ +170 B

Commit: f3d233d

@ijjk
Copy link
Member Author

ijjk commented Jan 20, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.1s 13.1s -21ms
nodeModulesSize 48.8 MB 48.8 MB ⚠️ +762 B
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.12 kB 5.12 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..c512.js gzip 16.3 kB 16.3 kB ⚠️ +22 B
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 70 kB 70 kB ⚠️ +22 B
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 15.1 kB 15.1 kB ⚠️ +23 B
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 64.7 kB 64.7 kB ⚠️ +23 B
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
index.html gzip 1.02 kB 1.02 kB ⚠️ +1 B
link.html gzip 1.03 kB 1.03 kB ⚠️ +1 B
withRouter.html gzip 1.02 kB 1.02 kB
Overall change 3.07 kB 3.07 kB ⚠️ +2 B

Diffs

Diff for de003c3a9d30..a8.module.js
@@ -2906,6 +2906,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
     /***/ elyg: /***/ function(module, exports, __webpack_require__) {
       'use strict'
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -3229,29 +3231,36 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
             if (is_dynamic_1.isDynamicRoute(route)) {
               var { pathname: asPathname } = url_1.parse(as)
-              var routeMatch = route_matcher_1.getRouteMatcher(
-                route_regex_1.getRouteRegex(route)
-              )(asPathname)
+              var routeRegex = route_regex_1.getRouteRegex(route)
+              var routeMatch = route_matcher_1.getRouteMatcher(routeRegex)(
+                asPathname
+              )
 
               if (!routeMatch) {
-                var error =
-                  'The provided `as` value ('
-                    .concat(
-                      asPathname,
-                      ') is incompatible with the `href` value ('
-                    )
-                    .concat(route, '). ') +
-                  'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
-
-                if (false) {
-                } else {
-                  console.error(error)
-                }
+                var missingParams = _Object$keys(routeRegex.groups).filter(
+                  param => !query[param]
+                )
 
-                return resolve(false)
-              } // Merge params into `query`, overwriting any specified in search
+                if (missingParams.length > 0) {
+                  if (false) {
+                  }
 
-              _Object$assign(query, routeMatch)
+                  return reject(
+                    new Error(
+                      'The provided `as` value ('
+                        .concat(
+                          asPathname,
+                          ') is incompatible with the `href` value ('
+                        )
+                        .concat(route, '). ') +
+                        'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                    )
+                  )
+                }
+              } else {
+                // Merge params into `query`, overwriting any specified in search
+                _Object$assign(query, routeMatch)
+              }
             }
 
             Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for de003c3a9d30..b35e11fb4.js
@@ -2557,6 +2557,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
       var _slicedToArray = __webpack_require__('8+Nu')
 
+      var _Object$keys = __webpack_require__('pLtp')
+
       var _Object$assign = __webpack_require__('Qetd')
 
       var _Promise = __webpack_require__('eVuF')
@@ -2918,29 +2920,38 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       var _url_1$parse2 = url_1.parse(as),
                         asPathname = _url_1$parse2.pathname
 
+                      var routeRegex = route_regex_1.getRouteRegex(route)
                       var routeMatch = route_matcher_1.getRouteMatcher(
-                        route_regex_1.getRouteRegex(route)
+                        routeRegex
                       )(asPathname)
 
                       if (!routeMatch) {
-                        var error =
-                          'The provided `as` value ('
-                            .concat(
-                              asPathname,
-                              ') is incompatible with the `href` value ('
-                            )
-                            .concat(route, '). ') +
-                          'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                        var missingParams = _Object$keys(
+                          routeRegex.groups
+                        ).filter(function(param) {
+                          return !query[param]
+                        })
 
-                        if (false) {
-                        } else {
-                          console.error(error)
+                        if (missingParams.length > 0) {
+                          if (false) {
+                          }
+
+                          return reject(
+                            new Error(
+                              'The provided `as` value ('
+                                .concat(
+                                  asPathname,
+                                  ') is incompatible with the `href` value ('
+                                )
+                                .concat(route, '). ') +
+                                'Read more: https://err.sh/zeit/next.js/incompatible-href-as'
+                            )
+                          )
                         }
-
-                        return resolve(false)
-                      } // Merge params into `query`, overwriting any specified in search
-
-                      _Object$assign(query, routeMatch)
+                      } else {
+                        // Merge params into `query`, overwriting any specified in search
+                        _Object$assign(query, routeMatch)
+                      }
                     }
 
                     Router.events.emit('routeChangeStart', as) // If shallow is true and the route exists in the router cache we reuse the previous result
Diff for index.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.9d13a4f99d1b35e11fb4.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e3187ecbc67463c50cda.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for link.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -156,13 +156,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.9d13a4f99d1b35e11fb4.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e3187ecbc67463c50cda.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"
Diff for withRouter.html
@@ -39,7 +39,7 @@
     />
     <link
       rel="preload"
-      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      href="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       as="script"
       crossorigin="anonymous"
     />
@@ -151,13 +151,13 @@
       type="module"
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.9d13a4f99d1b35e11fb4.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.e3187ecbc67463c50cda.js"
       async=""
       crossorigin="anonymous"
       nomodule=""
     ></script
     ><script
-      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.494ccc4c3d846ffaa4a8.module.js"
+      src="/_next/static/chunks/de003c3a9d308750aa009870a5926f9b18ab31f4.c0966633800149698b4b.module.js"
       async=""
       crossorigin="anonymous"
       type="module"

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
buildDuration 13.9s 14s ⚠️ +35ms
nodeModulesSize 48.8 MB 48.8 MB ⚠️ +762 B
Client Bundles (main, webpack, commons)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.js gzip 5.12 kB 5.12 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..c512.js gzip 16.3 kB N/A N/A
framework.HASH.js gzip 39.1 kB 39.1 kB
de003c3a9d30..4d1d.js gzip N/A 16.3 kB N/A
Overall change 70 kB 70 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 15.1 kB N/A N/A
framework.HA..dule.js gzip 39.1 kB 39.1 kB
de003c3a9d30..dule.js gzip N/A 15.1 kB N/A
Overall change 64.7 kB 64.7 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles Overall increase ⚠️
zeit/next.js canary ijjk/next.js update/allow-mismatch Change
_error.js gzip 70.9 kB 70.9 kB -2 B
hooks.html gzip 1.06 kB 1.06 kB
index.js gzip 71.3 kB 71.3 kB
link.js gzip 80.6 kB 80.6 kB ⚠️ +52 B
routerDirect.js gzip 78.2 kB 78.3 kB ⚠️ +60 B
withRouter.js gzip 78.3 kB 78.3 kB ⚠️ +60 B
Overall change 380 kB 381 kB ⚠️ +170 B

Commit: 8a1b804

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants