-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Fix React warning in ButtonGroup #1323
Fix React warning in ButtonGroup #1323
Conversation
Run & review this pull request in StackBlitz Codeflow. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis update refines the import approach for Changes
Possibly related issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/ui/src/components/Button/ButtonGroup.tsx (2 hunks)
Additional comments (3)
packages/ui/src/components/Button/ButtonGroup.tsx (3)
- 7-7: The import statement correctly imports
Button
andButtonProps
, which are necessary for the changes made in this pull request.- 32-45: The logic to conditionally apply the
positionInGroup
prop only toButton
components is correctly implemented. This should effectively resolve the issue with React warnings.Please ensure to verify the behavior with nested children, especially in complex component trees, to confirm that the recursive processing works as intended.
- 53-53: The
determinePosition
function correctly calculates a button's position within a group. The logic is clear and should work as intended.
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.
formatting
544cb84
to
1ba2a8f
Compare
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/ui/src/components/Button/ButtonGroup.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/ui/src/components/Button/ButtonGroup.tsx
Additional Context Used
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/ui/src/components/Button/ButtonGroup.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/ui/src/components/Button/ButtonGroup.tsx
Additional Context Used
Apologies, fixed. |
This change fixes the following issue: ButtonGroup was adding positionInGroup to all children rather than just Buttons. For example, in the following, both the Buttons and the child spans get positionInGroup props: ``` <Button.Group><Button><span>b1</span></Button><Button><span>b2</span></Button></Button.Group> ``` This results in a React warning: “Warning: React does not recognize the `positionInGroup` prop on a DOM element...” The review comment in the original code change causing this hints at this issue as well: themesberg#1273 (comment)
41c54e8
to
728aa5a
Compare
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/ui/src/components/Button/ButtonGroup.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/ui/src/components/Button/ButtonGroup.tsx
Summarize the changes made and the motivation behind them.
This change fixes the following issue that was introduced recently in commit d0dc810:
ButtonGroup was adding positionInGroup to all children rather than just Buttons. For example, in the following, both the Buttons and the child spans get positionInGroup props:
This results in a React warning: “Warning: React does not recognize the
positionInGroup
prop on a DOM element...”The review comment on the original commit hints at this issue as well:
#1273 (comment)
Summary by CodeRabbit