Skip to content
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

Bug: support fetchPriority in camel-case on DOM nodes. #27233

Closed
fmacherey opened this issue Aug 15, 2023 · 4 comments · Fixed by #25927
Closed

Bug: support fetchPriority in camel-case on DOM nodes. #27233

fmacherey opened this issue Aug 15, 2023 · 4 comments · Fixed by #25927
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@fmacherey
Copy link

At the moment, the HTML fetchPriority is only supported written as fetchpriority, see #26810

But as per DefinitelyTyped/DefinitelyTyped#65972 it is required in @types/react to be written as fetchPriority as it is also for other props e.g. imageSrcSet.

With spelling it as camel-case, react ejects a warning:

Warning: React does not recognize the `fetchPriority` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `fetchpriority` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    at link
    at head
    at Head (webpack-internal:///./node_modules/next/dist/pages/_document.js:258:1)
    at html
    at Html (webpack-internal:///./node_modules/next/dist/pages/_document.js:680:119)
    at MyDocument (webpack-internal:///./pages/_document.tsx:24:1)

Relevant versions:

"@types/react": "^18.2.20",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "13.4.12",
"typescript": "^5.1.6", 

Steps To Reproduce

Example component:

import React from "react";
import NextHead from "next/head";

type Props = {
    webP: string;
};

export const ImagePreload: React.FC<Props> = React.memo(({ webP }) => (
    <NextHead>
        <link
            key={`image-preload-${webP}`}
            rel="preload"
            as="image"
            imageSrcSet={webP}
            fetchPriority="high"
        />
    </NextHead>
));
ImagePreload.displayName = "ImagePreload";
@fmacherey fmacherey added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Aug 15, 2023
@Daniel3711997
Copy link

Still an issue...

@eps1lon
Copy link
Collaborator

eps1lon commented Apr 3, 2024

Fixed in #25927 which is part of the Canary and Experimental release channel.

Types were already added.

@kostia1st
Copy link

Is the fix planned for React 18.x.x?

@eps1lon
Copy link
Collaborator

eps1lon commented Jul 23, 2024

No. It will be part of React 19 and is already available in the React 19 RC (19.0.0-rc.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants