Skip to content

Commit c37ee49

Browse files
committed
fix faulty conditional
1 parent 4e53b49 commit c37ee49

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/core/src/hooks/useTransition.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,18 @@ export function useTransition(
433433
const { springs } = changes.get(t) || t.ctrl
434434
const elem: any = render({ ...springs }, t.item, t, i)
435435

436-
if (!elem || !elem.type) return elem
437-
438436
const key = is.str(t.key) || is.num(t.key) ? t.key : t.ctrl.id
439437
const isLegacyReact = React.version < '19.0.0'
440438

441-
return (
442-
<elem.type
443-
{...elem.props}
444-
key={key}
445-
{...(isLegacyReact && { ref: elem.ref })}
446-
/>
447-
)
439+
const props = {
440+
...elem.props,
441+
}
442+
443+
if (isLegacyReact) {
444+
props.ref = elem.ref
445+
}
446+
447+
return elem && elem.type ? <elem.type key={key} {...props} /> : elem
448448
})}
449449
</>
450450
)

0 commit comments

Comments
 (0)