-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React does not recognize the fetchPriority
prop on a DOM element.
#65161
Comments
Updated to latest nextjs last night, this started to appear as soon as I imported |
same waring, any use of Image from Next/Image |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Same as facebook/react#25682 ? Regression? |
This comment has been minimized.
This comment has been minimized.
To be clear, the warning only happens when running This sounds like an issue with |
Same issue here after updating Next from Rolling back Next to @styfle this happens using |
I see. This also seems to impact Pages Router + react@18.3.1
|
In a previous PR, #47302, detection for `fetchPriority` assumed that facebook/react#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 #47302 but they seem to run on react@18.2.0 which is why we don't see failures. Fixes #65161
This comment has been minimized.
This comment has been minimized.
because of issue vercel/next.js#65161
because of issue vercel/next.js#65161
This is fixed on the canary channel. You can try it out today with |
Among the conversion and linting there are additional changes included: * Set proper useEffect deps * Header: Fix initial arrow animation (unnecessary animating happened under the Splash) * Header: Remove unnecessary animation props that didn't have effect and do minor animation tweaks * Header: Remove the marquee "transition" key since it isn't a variant * Header: Rename NavItem -> HeaderNavItem * Header: Fix useMedia ssr error * Fix vercel/next.js#65161 * Relocate locomotive-scroll wrapper to components with proper types * Add build step script for Vercel, not active currently * Figure: Don't spread props since the invalid blur* attrs could be applied (vercel/next.js#56511) * Figure: Remove unnecessary props and add ones that could be needed * Figure: Add alt text to video also * Tweak tokens * Slightly tweak some content strings and styles * Refactor unnecessary stuff away from useInView hook * Bunch of file extension changes and sort tweaks * Relocate and fix component script * Sort keys, jsx props and destructured keys * Sitemap: Better key for projects * utility.js -> utils.ts
@styfle Thank you it solved my issue, but can you explain to me what was the issue and how this package solved it? |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
same here, fixed after |
In a previous PR, #47302, detection for `fetchPriority` assumed that facebook/react#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 #47302 but they seem to run on react@18.2.0 which is why we don't see failures. Fixes #65161
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as resolved.
This comment was marked as resolved.
…rnings related to next/image vercel/next.js#65161
Here is a better mock for Typescript support (placed in /* eslint-disable @next/next/no-img-element */
import React, { useMemo } from "react";
import type {
StaticImageData,
StaticRequire,
} from "next/dist/shared/lib/get-img-props";
type ImageProps = React.DetailedHTMLProps<
React.ImgHTMLAttributes<HTMLImageElement>,
HTMLImageElement
>;
type ModifiedImageProps = Omit<ImageProps, "src"> & {
src?: string | (StaticRequire | StaticImageData);
};
const NextImage = React.forwardRef<HTMLImageElement, ModifiedImageProps>((props, ref) => {
const { src, alt, ...rest } = props;
const imageSrc = useMemo(() => {
if (!src) {
return undefined;
}
if (typeof src === "string") {
return src;
}
if ("default" in src) {
return src.default.src;
}
return src.src;
}, [src]);
return (
<img
ref={ref}
src={imageSrc}
alt={alt}
/>
);
});
NextImage.displayName = "Image";
export default NextImage; I have edited this mock to not pass most of the props. I can't see why this is a problem as Next/Image props don't exactly line up to HTMLImage props and something like fill={true} will cause Jest to go nuts. |
This is fixed in next@14.2.4 |
Yup. I can now confirm it’s been fixed in 14.2.4 |
Thank you for getting this fixed. Its one of those errors I haven't been able to get rid of for a while now lol. |
Seems not to be fixed. Just ran into this problem for the first time today after a fresh install. |
## Current Behavior `fetchpriority` attribute error in Next image loading cmp. <img width="1260" alt="image" src="https://github.com/nrwl/nx/assets/542458/9ba9f539-e0ad-4fe1-9a6a-64db856fd25c"> ## Expected Behavior Upgrading patch version of next fixes it. //Edit: some context: vercel/next.js#65161 (comment) ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
## Current Behavior `fetchpriority` attribute error in Next image loading cmp. <img width="1260" alt="image" src="https://github.com/nrwl/nx/assets/542458/9ba9f539-e0ad-4fe1-9a6a-64db856fd25c"> ## Expected Behavior Upgrading patch version of next fixes it. //Edit: some context: vercel/next.js#65161 (comment) ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit 929a57c)
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/KDederichs/fetch-prio-reproducer
To Reproduce
npm install
jest
Current vs. Expected behavior
Should be no error there
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 20.11.0 npm: 10.2.4 Yarn: 1.22.19 pnpm: 8.15.1 Relevant Packages: next: 14.3.0-canary.30 // Latest available version is detected (14.3.0-canary.30). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Image (next/image)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
NEXT-3273
The text was updated successfully, but these errors were encountered: