-
Notifications
You must be signed in to change notification settings - Fork 10
fix: prevent passing props to Fragment in createRender #403
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
base: main
Are you sure you want to change the base?
Conversation
When createRender returns a Fragment (either as children, fallback, or wrapped non-element), useRender's internal cloneElement call attempts to merge props (including ref) into the Fragment, causing React warnings. This fix wraps Fragment returns in a render callback, which useRender calls directly instead of using cloneElement, preventing the props merge attempt.
🦋 Changeset detectedLatest commit: 131aeaf The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @MaxLee-dev, 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 resolves a specific React warning related to passing props to Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
안녕하세요. createRender에서 Fragment를 처리할 때 발생하는 React 경고를 수정해주셨네요. Fragment를 렌더 콜백으로 감싸서 useRender가 cloneElement를 호출하지 않도록 하는 해결책이 인상적입니다. 또한, 다양한 케이스를 커버하도록 테스트 코드를 구조적으로 개선해주셔서 코드의 안정성이 더욱 높아졌습니다. 좋은 수정 감사합니다!
|
✅ All tests passed!
Click here if you need to update snapshots. |
Summary
Invalid prop 'ref' supplied to 'React.Fragment'createRenderreturns a Fragment, wrap it in a render callback to preventuseRenderfrom attempting to merge props viacloneElementProblem
useRenderinternally callsReact.cloneElement(render, mergedProps)which tries to pass props (includingref) to Fragment elements. Since Fragment only acceptskeyandchildren, this causes React warnings.Solution
Detect Fragment elements and return them wrapped in a render callback
() => fragment. WhenuseRenderreceives a function, it calls it directly instead of usingcloneElement, avoiding the props merge issue.