Skip to content

Commit

Permalink
fix: correct react to preact type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Xstoudi committed Dec 25, 2023
1 parent 1264502 commit bdfef4e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Head.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import React, {
ComponentChildren,
FunctionComponent,
toChildArray,
} from 'preact'
import { cloneElement, ComponentChildren, FunctionComponent } from 'preact'
import { useEffect, useMemo, useContext } from 'preact/hooks'
import HeadContext from './HeadContext'

Expand Down Expand Up @@ -79,7 +75,7 @@ const Head: InertiaHead = function ({ children, title }) {
}

function ensureNodeHasInertiaProp(node) {
return React.cloneElement(node, {
return cloneElement(node, {
inertia:
node.props['head-key'] !== undefined ? node.props['head-key'] : '',
})
Expand All @@ -90,7 +86,7 @@ const Head: InertiaHead = function ({ children, title }) {
}

function renderNodes(nodes) {
const computed = toChildArray(nodes)
const computed = nodes
.filter((node) => node)
.map((node) => renderNode(node))
if (title && !computed.find((tag) => tag.startsWith('<title'))) {
Expand Down

0 comments on commit bdfef4e

Please sign in to comment.