rsnext/packages/next/client
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
..
dev Update to show build indicator while re-fetching GS(S)P data in dev (#16789) 2020-09-03 12:27:08 +00:00
head-manager.ts Remove next-head-count (#16758) 2020-09-09 01:41:04 +00:00
index.tsx Remove next-head-count (#16758) 2020-09-09 01:41:04 +00:00
link.tsx Ensure interpolating dynamic href values works correctly (#16774) 2020-09-02 16:23:26 +00:00
next-dev.js Update to show build indicator while re-fetching GS(S)P data in dev (#16789) 2020-09-03 12:27:08 +00:00
next.js Shave a few bytes off the bootstrap code (#14457) 2020-06-22 17:50:17 +00:00
normalize-trailing-slash.ts fix basepath trailing slash (#15200) 2020-07-15 23:53:31 +00:00
page-loader.ts Include additional query values when interpolating href (#16878) 2020-09-07 13:09:02 +02:00
performance-relayer.ts Convert performance relayer to TypeScript (#16161) 2020-08-13 15:20:29 +00:00
polyfills.js polyfills 2020-03-30 16:26:25 -04:00
router.ts Remove tslint disables (#16116) 2020-08-12 14:39:07 +00:00
with-router.tsx Convert wrapper class to function component (#9095) 2019-11-09 14:56:59 -08:00