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

Don't dedupe meta tags with the same name but unique keys #17099

Merged
merged 4 commits into from
Jan 3, 2021

Conversation

zbialecki
Copy link
Contributor

Currently there is no way to add multiple meta tags with the same name attribute to the head of a page. This PR modifies the Head component to allow multiple meta tags with the same name if they have unique keys.

This is important for integrating with certain services like Google Scholar and Swiftype.

Fixes #10183

@ijjk
Copy link
Member

ijjk commented Sep 15, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
buildDuration 11.9s 12.3s ⚠️ +372ms
nodeModulesSize 60 MB 60 MB ⚠️ +248 B
Page Load Tests Overall increase ✓
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
/ failed reqs 0 0
/ total time (seconds) 2.231 2.102 -0.13
/ avg req/sec 1120.77 1189.24 +68.47
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.244 1.176 -0.07
/error-in-render avg req/sec 2009.98 2125.02 +115.04
Client Bundles (main, webpack, commons)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..9339.js gzip 10.9 kB 10.9 kB
framework.HASH.js gzip 39 kB 39 kB
main-a3dd6a0..948f.js gzip 7.16 kB 7.16 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 57.8 kB 57.8 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..dule.js gzip 6.77 kB 6.77 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-e6089e5..dule.js gzip 6.23 kB 6.23 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-ed1b0..8fbd.js gzip 3.44 kB 3.46 kB ⚠️ +17 B
hooks-89731c..c609.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d2344ce..8b36.js gzip 1.3 kB 1.3 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 7.71 kB 7.72 kB ⚠️ +17 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-4469a..dule.js gzip 2.29 kB 2.31 kB ⚠️ +20 B
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-f8c0daf..dule.js gzip 1.26 kB 1.26 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.36 kB 5.38 kB ⚠️ +20 B
Client Build Manifests Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_buildManifest.js gzip 322 B 323 B ⚠️ +1 B
_buildManife..dule.js gzip 329 B 331 B ⚠️ +2 B
Overall change 651 B 654 B ⚠️ +3 B
Rendered Page Sizes
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
index.html gzip 1 kB 1 kB
link.html gzip 1.01 kB 1.01 kB
withRouter.html gzip 996 B 996 B
Overall change 3.01 kB 3.01 kB

Diffs

Diff for _buildManifest.js
@@ -2,7 +2,7 @@ self.__BUILD_MANIFEST = {
   __rewrites: [],
   "/": ["static\u002Fchunks\u002Fpages\u002Findex-283eed3c1520dcc26e8d.js"],
   "/_error": [
-    "static\u002Fchunks\u002Fpages\u002F_error-a0c4519f5ca8e97fa7be.js"
+    "static\u002Fchunks\u002Fpages\u002F_error-f5570f27b7962f45c534.js"
   ],
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
Diff for _buildManifest.module.js
@@ -4,7 +4,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Findex-dc79232991b9d18c3260.module.js"
   ],
   "/_error": [
-    "static\u002Fchunks\u002Fpages\u002F_error-714d7bb4196263406c6e.module.js"
+    "static\u002Fchunks\u002Fpages\u002F_error-210d043f855318a2b6d7.module.js"
   ],
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
Diff for _error-714d7..6e.module.js
@@ -372,8 +372,10 @@ Also adds support for deduplicated `key` properties
         var metaCategories = {};
         return h => {
           var isUnique = true;
+          var hasKey = false;
 
           if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
+            hasKey = true;
             var key = h.key.slice(h.key.indexOf("$") + 1);
 
             if (keys.has(key)) {
@@ -409,7 +411,10 @@ Also adds support for deduplicated `key` properties
                   var category = h.props[metatype];
                   var categories = metaCategories[metatype] || new Set();
 
-                  if (categories.has(category)) {
+                  if (
+                    (metatype !== "name" || !hasKey) &&
+                    categories.has(category)
+                  ) {
                     isUnique = false;
                   } else {
                     categories.add(category);
Diff for _error-a0c45..8e97fa7be.js
@@ -461,8 +461,10 @@ Also adds support for deduplicated `key` properties
         var metaCategories = {};
         return function(h) {
           var isUnique = true;
+          var hasKey = false;
 
           if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
+            hasKey = true;
             var key = h.key.slice(h.key.indexOf("$") + 1);
 
             if (keys.has(key)) {
@@ -498,7 +500,10 @@ Also adds support for deduplicated `key` properties
                   var category = h.props[metatype];
                   var categories = metaCategories[metatype] || new Set();
 
-                  if (categories.has(category)) {
+                  if (
+                    (metatype !== "name" || !hasKey) &&
+                    categories.has(category)
+                  ) {
                     isUnique = false;
                   } else {
                     categories.add(category);

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
buildDuration 13.3s 13.4s ⚠️ +163ms
nodeModulesSize 60 MB 60 MB ⚠️ +248 B
Client Bundles (main, webpack, commons)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..9339.js gzip 10.9 kB 10.9 kB
framework.HASH.js gzip 39 kB 39 kB
main-a3dd6a0..948f.js gzip 7.16 kB 7.16 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 57.8 kB 57.8 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..dule.js gzip 6.77 kB 6.77 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-e6089e5..dule.js gzip 6.23 kB 6.23 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 52.7 kB 52.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-9a0b9e1..b37e.js gzip 1.28 kB 1.28 kB
_error-ed1b0..8fbd.js gzip 3.44 kB N/A N/A
hooks-89731c..c609.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-d2344ce..8b36.js gzip 1.3 kB 1.3 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
_error-209c0..9232.js gzip N/A 3.46 kB N/A
Overall change 7.71 kB 7.72 kB ⚠️ +17 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-4469a..dule.js gzip 2.29 kB N/A N/A
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-f8c0daf..dule.js gzip 1.26 kB 1.26 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
_error-12803..dule.js gzip N/A 2.31 kB N/A
Overall change 5.36 kB 5.38 kB ⚠️ +20 B
Client Build Manifests Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_buildManifest.js gzip 322 B 323 B ⚠️ +1 B
_buildManife..dule.js gzip 329 B 331 B ⚠️ +2 B
Overall change 651 B 654 B ⚠️ +3 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_error.js 1.04 MB 1.04 MB ⚠️ +81 B
404.html 4.34 kB 4.34 kB
hooks.html 3.92 kB 3.92 kB
index.js 1.04 MB 1.04 MB ⚠️ +81 B
link.js 1.08 MB 1.08 MB ⚠️ +81 B
routerDirect.js 1.08 MB 1.08 MB ⚠️ +81 B
withRouter.js 1.08 MB 1.08 MB ⚠️ +81 B
Overall change 5.31 MB 5.31 MB ⚠️ +405 B
Commit: 6063c3a

@vercel vercel bot temporarily deployed to Preview November 18, 2020 18:23 Inactive
@ijjk
Copy link
Member

ijjk commented Nov 18, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
buildDuration 13.7s 12.6s -1s
nodeModulesSize 85 MB 85 MB ⚠️ +248 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
/ failed reqs 0 0
/ total time (seconds) 2.394 2.382 -0.01
/ avg req/sec 1044.2 1049.35 +5.15
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.214 1.239 ⚠️ +0.03
/error-in-render avg req/sec 2059.01 2018.29 ⚠️ -40.72
Client Bundles (main, webpack, commons)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..776c.js gzip 12.7 kB 12.7 kB
framework.HASH.js gzip 39 kB 39 kB
main-f1a49fb..e45e.js gzip 6.52 kB 6.52 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 58.9 kB 58.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..dule.js gzip 8.26 kB 8.26 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-28351af..dule.js gzip 5.63 kB 5.63 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 53.6 kB 53.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-3b0cf13..85f8.js gzip 1.28 kB 1.28 kB
_error-6f635..c393.js gzip 3.44 kB 3.46 kB ⚠️ +17 B
hooks-d4ffc3..9e0f.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-b618194..5477.js gzip 1.61 kB 1.61 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
Overall change 8.01 kB 8.03 kB ⚠️ +17 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-f2fcc..dule.js gzip 2.29 kB 2.31 kB ⚠️ +20 B
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-9741e7f..dule.js gzip 1.55 kB 1.55 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
Overall change 5.64 kB 5.66 kB ⚠️ +20 B
Client Build Manifests Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_buildManifest.js gzip 321 B 321 B
_buildManife..dule.js gzip 329 B 330 B ⚠️ +1 B
Overall change 650 B 651 B ⚠️ +1 B
Rendered Page Sizes
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
index.html gzip 966 B 966 B
link.html gzip 974 B 974 B
withRouter.html gzip 959 B 959 B
Overall change 2.9 kB 2.9 kB

Diffs

Diff for _buildManifest.js
@@ -2,7 +2,7 @@ self.__BUILD_MANIFEST = {
   __rewrites: [],
   "/": ["static\u002Fchunks\u002Fpages\u002Findex-283eed3c1520dcc26e8d.js"],
   "/_error": [
-    "static\u002Fchunks\u002Fpages\u002F_error-760f653e71e48010adf7.js"
+    "static\u002Fchunks\u002Fpages\u002F_error-cb9118dd9fe27f613aaa.js"
   ],
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-880757f1d73d6b241fc3.js"
Diff for _buildManifest.module.js
@@ -4,7 +4,7 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Findex-dc79232991b9d18c3260.module.js"
   ],
   "/_error": [
-    "static\u002Fchunks\u002Fpages\u002F_error-b59ce1d1aef722bdb502.module.js"
+    "static\u002Fchunks\u002Fpages\u002F_error-bba62905f8c874b4bb8b.module.js"
   ],
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
Diff for _error-760f6..48010adf7.js
@@ -461,8 +461,10 @@ Also adds support for deduplicated `key` properties
         var metaCategories = {};
         return function(h) {
           var isUnique = true;
+          var hasKey = false;
 
           if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
+            hasKey = true;
             var key = h.key.slice(h.key.indexOf("$") + 1);
 
             if (keys.has(key)) {
@@ -498,7 +500,10 @@ Also adds support for deduplicated `key` properties
                   var category = h.props[metatype];
                   var categories = metaCategories[metatype] || new Set();
 
-                  if (categories.has(category)) {
+                  if (
+                    (metatype !== "name" || !hasKey) &&
+                    categories.has(category)
+                  ) {
                     isUnique = false;
                   } else {
                     categories.add(category);
Diff for _error-b59ce..02.module.js
@@ -372,8 +372,10 @@ Also adds support for deduplicated `key` properties
         var metaCategories = {};
         return h => {
           var isUnique = true;
+          var hasKey = false;
 
           if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
+            hasKey = true;
             var key = h.key.slice(h.key.indexOf("$") + 1);
 
             if (keys.has(key)) {
@@ -409,7 +411,10 @@ Also adds support for deduplicated `key` properties
                   var category = h.props[metatype];
                   var categories = metaCategories[metatype] || new Set();
 
-                  if (categories.has(category)) {
+                  if (
+                    (metatype !== "name" || !hasKey) &&
+                    categories.has(category)
+                  ) {
                     isUnique = false;
                   } else {
                     categories.add(category);

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
buildDuration 14.4s 14.5s ⚠️ +61ms
nodeModulesSize 85 MB 85 MB ⚠️ +248 B
Client Bundles (main, webpack, commons)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..776c.js gzip 12.7 kB 12.7 kB
framework.HASH.js gzip 39 kB 39 kB
main-f1a49fb..e45e.js gzip 6.52 kB 6.52 kB
webpack-e067..f178.js gzip 751 B 751 B
Overall change 58.9 kB 58.9 kB
Client Bundles (main, webpack, commons) Modern
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..dule.js gzip 8.26 kB 8.26 kB
framework.HA..dule.js gzip 39 kB 39 kB
main-28351af..dule.js gzip 5.63 kB 5.63 kB
webpack-07c5..dule.js gzip 751 B 751 B
Overall change 53.6 kB 53.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
polyfills-4b..e242.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-3b0cf13..85f8.js gzip 1.28 kB 1.28 kB
_error-6f635..c393.js gzip 3.44 kB N/A N/A
hooks-d4ffc3..9e0f.js gzip 887 B 887 B
index-17468f..5d83.js gzip 227 B 227 B
link-b618194..5477.js gzip 1.61 kB 1.61 kB
routerDirect..924c.js gzip 284 B 284 B
withRouter-7..c13d.js gzip 284 B 284 B
_error-c5ac8..0748.js gzip N/A 3.46 kB N/A
Overall change 8.01 kB 8.03 kB ⚠️ +17 B
Client Pages Modern Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-75d3a82..dule.js gzip 625 B 625 B
_error-f2fcc..dule.js gzip 2.29 kB N/A N/A
hooks-cbf13f..dule.js gzip 387 B 387 B
index-b9a643..dule.js gzip 226 B 226 B
link-9741e7f..dule.js gzip 1.55 kB 1.55 kB
routerDirect..dule.js gzip 284 B 284 B
withRouter-f..dule.js gzip 282 B 282 B
_error-2cbbc..dule.js gzip N/A 2.31 kB N/A
Overall change 5.64 kB 5.66 kB ⚠️ +20 B
Client Build Manifests Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_buildManifest.js gzip 321 B 321 B
_buildManife..dule.js gzip 329 B 330 B ⚠️ +1 B
Overall change 650 B 651 B ⚠️ +1 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_error.js 918 kB 918 kB ⚠️ +81 B
404.html 4.61 kB 4.61 kB
hooks.html 3.86 kB 3.86 kB
index.js 918 kB 918 kB ⚠️ +81 B
link.js 977 kB 977 kB ⚠️ +81 B
routerDirect.js 969 kB 969 kB ⚠️ +81 B
withRouter.js 969 kB 969 kB ⚠️ +81 B
Overall change 4.76 MB 4.76 MB ⚠️ +405 B
Commit: 1658a0a

@lachlanjc
Copy link
Contributor

Would be awesome to see this land!

@timneutkens
Copy link
Member

Thanks! This seems fine for now, but I think the name deduping could be removed altogether

@ijjk
Copy link
Member

ijjk commented Jan 3, 2021

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
buildDuration 10.5s 10.9s ⚠️ +333ms
nodeModulesSize 80.6 MB 80.6 MB ⚠️ +248 B
Page Load Tests Overall increase ✓
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
/ failed reqs 0 0
/ total time (seconds) 2.137 2.115 -0.02
/ avg req/sec 1169.99 1182.19 +12.2
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.335 1.324 -0.01
/error-in-render avg req/sec 1872.42 1888.18 +15.76
Client Bundles (main, webpack, commons)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..42af.js gzip 13 kB 13 kB
framework.HASH.js gzip 39 kB 39 kB
main-a9a6f0d..a96d.js gzip 6.59 kB 6.59 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.3 kB 59.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-cfcb6..fe1c.js gzip 3.44 kB 3.46 kB ⚠️ +17 B
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-705099c..c35d.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
Overall change 8.08 kB 8.09 kB ⚠️ +17 B
Client Build Manifests
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Rendered Page Sizes
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
index.html gzip 615 B 615 B
link.html gzip 621 B 621 B
withRouter.html gzip 607 B 607 B
Overall change 1.84 kB 1.84 kB

Diffs

Diff for _buildManifest.js
@@ -2,7 +2,7 @@ self.__BUILD_MANIFEST = {
   __rewrites: [],
   "/": ["static\u002Fchunks\u002Fpages\u002Findex-5219d40a02e71ed7dcbf.js"],
   "/_error": [
-    "static\u002Fchunks\u002Fpages\u002F_error-691e25800d10f0f794d2.js"
+    "static\u002Fchunks\u002Fpages\u002F_error-20af334c64d8a5dc13e8.js"
   ],
   "/hooks": [
     "static\u002Fchunks\u002Fpages\u002Fhooks-61cb7b66e376b851f63a.js"
Diff for _error-691e2..0f0f794d2.js
@@ -461,8 +461,10 @@ Also adds support for deduplicated `key` properties
         var metaCategories = {};
         return function(h) {
           var isUnique = true;
+          var hasKey = false;
 
           if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
+            hasKey = true;
             var key = h.key.slice(h.key.indexOf("$") + 1);
 
             if (keys.has(key)) {
@@ -498,7 +500,10 @@ Also adds support for deduplicated `key` properties
                   var category = h.props[metatype];
                   var categories = metaCategories[metatype] || new Set();
 
-                  if (categories.has(category)) {
+                  if (
+                    (metatype !== "name" || !hasKey) &&
+                    categories.has(category)
+                  ) {
                     isUnique = false;
                   } else {
                     categories.add(category);

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
buildDuration 12.6s 12.8s ⚠️ +143ms
nodeModulesSize 80.6 MB 80.6 MB ⚠️ +248 B
Client Bundles (main, webpack, commons)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
677f882d2ed8..42af.js gzip 13 kB 13 kB
framework.HASH.js gzip 39 kB 39 kB
main-a9a6f0d..a96d.js gzip 6.59 kB 6.59 kB
webpack-50be..df5b.js gzip 751 B 751 B
Overall change 59.3 kB 59.3 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
polyfills-81..14d7.js gzip 31.2 kB 31.2 kB
Overall change 31.2 kB 31.2 kB
Client Pages Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_app-b6fc6bc..222c.js gzip 1.28 kB 1.28 kB
_error-cfcb6..fe1c.js gzip 3.44 kB N/A N/A
hooks-010c20..8411.js gzip 887 B 887 B
index-bbee2f..528b.js gzip 227 B 227 B
link-705099c..c35d.js gzip 1.64 kB 1.64 kB
routerDirect..bf84.js gzip 303 B 303 B
withRouter-a..5826.js gzip 302 B 302 B
_error-e2ffa..0f3f.js gzip N/A 3.46 kB N/A
Overall change 8.08 kB 8.09 kB ⚠️ +17 B
Client Build Manifests
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_buildManifest.js gzip 323 B 323 B
Overall change 323 B 323 B
Serverless bundles Overall increase ⚠️
vercel/next.js canary zbialecki/next.js fix/meta-tag-unique-key Change
_error.js 1 MB 1 MB ⚠️ +81 B
404.html 2.67 kB 2.67 kB
hooks.html 1.92 kB 1.92 kB
index.js 1 MB 1 MB ⚠️ +81 B
link.js 1.06 MB 1.06 MB ⚠️ +81 B
routerDirect.js 1.05 MB 1.05 MB ⚠️ +81 B
withRouter.js 1.05 MB 1.05 MB ⚠️ +81 B
Overall change 5.17 MB 5.17 MB ⚠️ +405 B
Commit: bf52562

@kodiakhq kodiakhq bot merged commit f412547 into vercel:canary Jan 3, 2021
@zbialecki
Copy link
Contributor Author

@timneutkens thanks for merging. I'd be happy to create the PR removing the name deduping (only dedupe based on key) if that's the direction you want to go in.

@zbialecki zbialecki deleted the fix/meta-tag-unique-key branch January 3, 2021 16:53
@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't provide multiple meta tags with the same name
4 participants