rsnext/packages
Gerald Monaco 039eb817e1
Remove next-head-count (#16758)
Removes `next-head-count`, improving support for 3rd party libraries that insert or append new elements to `<head>`.

---

This is more or less what a solution with a `data-` attribute would look like, except that instead of directly searching for elements with that attribute, we serialize the elements expected in `<head>` and then find them/assume ownership of them during initialization (in a manner similar to React's reconciliation) based on their properties.

There are two main assumptions here:
1. Content is served with compression, so duplicate serialization of e.g. inline script or style tags doesn't have a meaningful impact. Storing a hash would be a potential optimization.
2. 3rd party libraries primarily only insert new, unique elements to head. Libraries trying to actively manage elements that overlap with those that Next.js claims ownership of will still be unsupported.

The reason for this roundabout approach is that I'd really like to avoid `data-` if possible, for maximum compatibility. Implicitly adding an attribute could be a breaking change for some class of tools or crawlers and makes it otherwise impossible to insert raw HTML into `<head>`. Adding an unexpected attribute is why the original `class="next-head"` approach was problematic in the first place!

That said, while I don't expect this to be more problematic than `next-head-count` (anything that would break in this new model also should have broken in the old model), if that does end up being the case, it might make sense to just bite the bullet.

Fixes #11012
Closes #16707

---

cc @Timer @timneutkens
2020-09-09 01:41:04 +00:00
..
create-next-app v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
eslint-plugin-next v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next Remove next-head-count (#16758) 2020-09-09 01:41:04 +00:00
next-bundle-analyzer v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next-codemod v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next-mdx v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next-plugin-google-analytics v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next-plugin-sentry v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next-plugin-storybook v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
next-polyfill-nomodule v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
react-dev-overlay v9.5.4-canary.6 2020-09-08 11:07:29 +02:00
react-refresh-utils v9.5.4-canary.6 2020-09-08 11:07:29 +02:00