Skip to content

fix(shared): stop React 19 element.ref warnings from Link and tooltips - #7553

Merged
idoshamun merged 2 commits into
mainfrom
react-19-ref-warnings
Dec 2, 2026
Merged

idoshamun merged 2 commits into
mainfrom
react-19-ref-warnings

Conversation

@idoshamun

@idoshamun idoshamun commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Changes

Follow-up to the React 19 upgrade (#7545). In dev, React 19 logs "Accessing element.ref was removed in React 19" whenever code reads element.ref on an element that has a ref prop. Production was never affected.

  • next/link with legacyBehavior reads the child's element.ref. The shared Link now renders an <a> child that carries a ref (ProfileLink, SourceAvatarLink, TopStoryWidget) through next/link's default mode, with the anchor's props on the link, so the ref, onClick and classes land on the same <a>. Every other Link keeps legacyBehavior, so the 470 other call sites are unchanged.
  • @tippyjs/react 4.2.6 (no longer maintained) reads children.ref on every tooltip. A pnpm patch (patches/@tippyjs__react@4.2.6.patch) reads children.props.ref instead.

Moving every Link off legacyBehavior (Next's new-link codemod) is a separate, larger change and isn't needed to clear these warnings.

Events

Did you introduce any new tracking events?

No

Experiment

Did you introduce any new experiments?

No

Manual Testing

Caution

Please make sure existing components are not breaking/affected by this PR

  • A scratch Jest test (not committed): legacy next/link with a ref child logs the warning. The shared Link with a ref'd <a> logs nothing, and keeps the ref on the <a>, href, class and onClick (with preventDefault honored). ProfileLink inside BaseTooltip and a ref'd button inside BaseTooltip log nothing and keep their refs.
  • Typecheck, the strict check, and the full Jest suites pass: shared 4,803 tests, webapp 705, extension 62.

Generated by Claude Code

Preview domain

https://react-19-ref-warnings.preview.app.daily.dev

React 19 logs "Accessing element.ref was removed in React 19" in dev
whenever code reads `element.ref` on an element that has a ref prop.

- next/link in legacyBehavior reads the child's `element.ref`. The shared
  Link now renders an `<a>` child that carries a ref (ProfileLink,
  SourceAvatarLink, TopStoryWidget) through next/link's default mode, with
  the anchor's props on the link, so its ref, handlers and classes reach
  the same `<a>`. Every other Link keeps legacyBehavior.
- @tippyjs/react 4.2.6 (unmaintained) reads `children.ref` on every
  tooltip. A pnpm patch reads `children.props.ref` instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FodmVtyvRGwavusAekpEXw
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
daily-webapp Ready Ready Preview Dec 2, 2026 1:16pm UTC

Request Review

@idoshamun
idoshamun merged commit 19c268b into main Dec 2, 2026
12 checks passed
@idoshamun
idoshamun deleted the react-19-ref-warnings branch December 2, 2026 13:16

This branch was successfully deployed

1 active deployment
Preview — 6bdc7c3e Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants