Add support for fetchpriority attribute to img#491
Add support for fetchpriority attribute to img#491piotrd wants to merge 2 commits intoreact-component:masterfrom
fetchpriority attribute to img#491Conversation
Add 'fetchPriority' to common attributes list
|
@piotrd is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @piotrd, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature by adding support for the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for the fetchpriority attribute on the <img> element by adding fetchPriority to the list of common props. However, the implementation is incomplete. The ImageElementProps type in src/interface.ts needs to be updated to include fetchPriority to avoid a TypeScript error. Additionally, it would be beneficial to add a new test case to verify that the fetchPriority prop is correctly passed to the underlying <img> element.
| 'srcSet', | ||
| 'useMap', | ||
| 'alt', | ||
| 'fetchPriority' |
There was a problem hiding this comment.
While adding fetchPriority here is correct, it's missing from the ImageElementProps type in src/interface.ts. This will cause a TypeScript compilation error because COMMON_PROPS is typed as (keyof Omit<ImageElementProps, 'src'>)[].
Please update ImageElementProps in src/interface.ts to include fetchPriority:
// src/interface.ts
export type ImageElementProps = Pick<
React.ImgHTMLAttributes<HTMLImageElement>,
| 'src'
| 'crossOrigin'
| 'decoding'
| 'draggable'
| 'loading'
| 'referrerPolicy'
| 'sizes'
| 'srcSet'
| 'useMap'
| 'alt'
| 'fetchPriority' // Add this line
>;
Fixes #490