Repository navigation
Changed
- On React 16–18, a
<Helmet>in the browser counts once it mounts instead of when it first renders. In development,<StrictMode>mounts components, unmounts them and mounts them again, so withdefer={false}a newly mounted<Helmet>'s tags are removed and added again, andonChangeClientStateis called again. Withdeferon, the default, those changes are applied together, once. - A
<link rel="alternate" hreflang>in an inner<Helmet>replaces the outer<Helmet>s' alternate links for the same language, as arel="canonical"link replaces theirs, instead of being added to them. Nested<Helmet>s that each list the translations of their page output only the innermost page's, plus outer links for languages it doesn't list. Alternate links withtypeormedia, such as feeds, are still matched byhref.
Fixed
- Which tags an inner
<Helmet>replaces no longer depends on the order of their attributes. Withhrefbeforerel, a<link>whoserelisn'tcanonicalorstylesheetwas matched byrelinstead ofhref, so an inner<Helmet>'srel="alternate"orrel="icon"link removed every outer link with thatrel, such as an RSS feed, andhref={null}was written ashref="null"instead of leaving the tag out. A<meta>with more than one ofname,charset,http-equiv,propertyanditempropis matched by the last of them in that order, and a<script>with bothsrcand content by its content, as they were when written in that order. <script>,<style>and<noscript>children that mix text and values, such as<script>var id = "{id}";</script>, are joined into one string. They threwTypeError: tag[primaryAttributeKey].toLowerCase is not a function.- On React 16–18, a
<Helmet>inside a<Suspense>boundary applies its tags once the boundary shows it. When a sibling suspended, the tags were applied while the fallback showed, and since React threw that render away, they stayed after the boundary unmounted, leaving the title of a page that was gone. When a boundary that had shown its content showed its fallback again, the<Helmet>'s tags were removed and not added back once the content showed, and when that<Helmet>unmounted, another<Helmet>'s tags were removed instead. - On React 16–18, attributes set to
falseornull, such asdefer={false}on a<script>orhidden={false}inbodyAttributes, are left out oftoString()and the DOM, as React leaves them out. They were written asdefer="false", or as an emptyhidden=""forbodyAttributes,htmlAttributesandtitleAttributesin the DOM, and browsers treat a boolean attribute with any value as on. As in React,falseis still written as"false"fordata-*andaria-*attributes and forcontenteditable,draggableandspellcheck. - On React 16–18, a
0inbodyAttributes,htmlAttributesortitleAttributes, such astabIndex={0}, is set as0in the DOM instead of an empty value. - On React 16–18, tags in the browser stay in the order they're given when some of them change. A changed tag was moved after the unchanged tags of its type, so swapping one of two stylesheets put it after the other and changed which rules won, and a changed inline
<script>moved after the scripts that followed it. Unchanged tags still aren't added again, and only move when the tags are reordered.
Full changes: v3.1.0...v3.2.0