Skip to content

React 19 - element.ref deprecation - update Slot implementation #1775

@Mista-T

Description

@Mista-T

The internal Tooltip component throws a deprecation warning when used with asChild in a React 19 application for a while now:
"Accessing element.ref is no longer supported. ref is now a regular prop. It will be removed from the JSX Element type in a future release."

Are you planning to update the react package's internal SlotClone mechanism?
( SlotClone: @vidstack/react@1.12.13 )

Source: https://github.com/vidstack/player/blob/main/packages/react/src/components/primitives/slot.tsx
Line 71 "(children as any).ref" is the culprit: "ref: forwardedRef ? composeRefs(forwardedRef, (children as any).ref) : (children as any).ref,"

See: https://tr.react.dev/blog/2024/04/25/react-19-upgrade-guide#deprecated-element-ref

Thanks a lot folks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions