next.js
68d5a389 - fix(next/image): detect react@19 for `fetchPriority` prop (#65235)

Commit
1 year ago
fix(next/image): detect react@19 for `fetchPriority` prop (#65235) In a previous PR, https://github.com/vercel/next.js/pull/47302, detection for `fetchPriority` assumed that https://github.com/facebook/react/pull/25927 would land in react@18.3.0 because that was the react@canary version at the time. However, it didn't land in react@18.3.0 and it is expected to land in react@19.0.0 due to the breaking change. This means that users upgrading to react@18.3.0 will see a warning. The fix is to stop looking at the `React.version` string and instead check for `React.use`, a feature that [will land in react@19.0.0](https://react.dev/blog/2024/04/25/react-19#new-feature-use) but is also available in react@canary and react@beta today. Note: There were tests added for App Router and Pages Router in a previous PR https://github.com/vercel/next.js/pull/47302 but they seem to run on react@18.2.0 which is why we don't see failures. Fixes https://github.com/vercel/next.js/issues/65161
Author
Parents
Loading