When putting dynamic value or javascript in a tag's content inside Inertia's Head component, it compiles to a jsx element containing an any[] children. renderTag function from Head will recursively render every children, and in this case, trying to access a string node.props will throw an uncatched exception and will break rendering:
Taking as example the React playground from Inertia repository,
Would break rendering and just return the template html to the client:
Note that nor the tags inside of Head have been rendered.
Making the following change at Head components (in Vue and React packages) avoid trying to access node.props from the node if it is a string and fixes the issue:
// Head.ts (react package) and head.ts (vue packages)
function renderTag(node) {
if (typeof node === "string") {
return node
}
// ...
}
When putting dynamic value or javascript in a tag's content inside Inertia's Head component, it compiles to a jsx element containing an any[] children.
renderTag
function from Head will recursively render every children, and in this case, trying to access a string node.props will throw an uncatched exception and will break rendering:Taking as example the React playground from Inertia repository,
Would break rendering and just return the template html to the client:
Note that nor the tags inside of Head have been rendered.
Making the following change at Head components (in Vue and React packages) avoid trying to access
node.props
from the node if it is a string and fixes the issue: