Skip to content

v3.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 03:26
85ebd34

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 with defer={false} a newly mounted <Helmet>'s tags are removed and added again, and onChangeClientState is called again. With defer on, 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 a rel="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 with type or media, such as feeds, are still matched by href.

Fixed

  • Which tags an inner <Helmet> replaces no longer depends on the order of their attributes. With href before rel, a <link> whose rel isn't canonical or stylesheet was matched by rel instead of href, so an inner <Helmet>'s rel="alternate" or rel="icon" link removed every outer link with that rel, such as an RSS feed, and href={null} was written as href="null" instead of leaving the tag out. A <meta> with more than one of name, charset, http-equiv, property and itemprop is matched by the last of them in that order, and a <script> with both src and 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 threw TypeError: 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 false or null, such as defer={false} on a <script> or hidden={false} in bodyAttributes, are left out of toString() and the DOM, as React leaves them out. They were written as defer="false", or as an empty hidden="" for bodyAttributes, htmlAttributes and titleAttributes in the DOM, and browsers treat a boolean attribute with any value as on. As in React, false is still written as "false" for data-* and aria-* attributes and for contenteditable, draggable and spellcheck.
  • On React 16–18, a 0 in bodyAttributes, htmlAttributes or titleAttributes, such as tabIndex={0}, is set as 0 in 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