react-helmet icon indicating copy to clipboard operation
react-helmet copied to clipboard

Fixed determining primary attribute key for meta tags

Open alex-bukach opened this issue 3 years ago • 1 comments

Problem / Motivation

primaryAttributeKey is set to the last item in the primaryAttributes array which matches the conditions. If the last property value is null, the whole meta tag will be discarded.

An example: <meta content={'some-content'} property={'some-value'} name={null} />. Here primaryAttributeKey will be set to name (as it is last in the list of properties), and then the meta tag will not be rendered as name is null.

Proposed solution

To avoid such situations we should consider only properties with non-false values as candidates for primaryAttributeKey.

alex-bukach avatar Nov 08 '22 17:11 alex-bukach

Can we write tests as well?

alexandermirzoyan avatar Jul 03 '24 08:07 alexandermirzoyan