For example, use the following two tags:
<Meta name="theme-color" media="(prefers-color-scheme: light)" content="#fff" />
<Meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000" />
Only the latter will actually be rendered.
The problem lies here:
|
actions.addServerTag = (tagDesc: TagDescription) => { |
|
const { tags = [] } = props; |
|
// tweak only cascading tags |
|
if (cascadingTags.indexOf(tagDesc.tag) !== -1) { |
|
const index = tags.findIndex(prev => { |
|
const prevName = prev.props.name || prev.props.property; |
|
const nextName = tagDesc.props.name || tagDesc.props.property; |
|
return prev.tag === tagDesc.tag && prevName === nextName; |
|
}); |
|
if (index !== -1) { |
|
tags.splice(index, 1); |
|
} |
|
} |
|
tags.push(tagDesc); |
|
}; |
This function seems to remove duplicate tags, but only name or property attributes are compared when checking whether they are duplicates.
I suppose to sort props by key and then serialize it as the unique key of a tag for comparison.
For example, use the following two tags:
Only the latter will actually be rendered.
The problem lies here:
solid-meta/src/index.tsx
Lines 156 to 170 in c9d21ef
This function seems to remove duplicate tags, but only
nameorpropertyattributes are compared when checking whether they are duplicates.I suppose to sort
propsby key and then serialize it as the unique key of a tag for comparison.