-
Notifications
You must be signed in to change notification settings - Fork 0
Fix styled-components props to prevent React DOM warnings #481
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: develop
Are you sure you want to change the base?
Fix styled-components props to prevent React DOM warnings #481
Conversation
Co-authored-by: Foxhoundn <[email protected]>
Co-authored-by: Foxhoundn <[email protected]>
Co-authored-by: Foxhoundn <[email protected]>
src/components/Checkbox/index.tsx
Outdated
| theme={theme} | ||
| checked={checked} | ||
| $checked={checked} | ||
| parentHasGradient={!!effect?.gradient} |
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.
@copilot It's missing here for labelPosition, effect and parentHasGradient
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.
Fixed in commit af9491f. Added $ prefix for parentHasGradient prop and removed unused labelPosition prop from StyledSwitch component. The effect prop is kept as it's used by the styled-components system for the interactive styling.
|
@copilot can you continue your work? |
…om StyledSwitch Co-authored-by: Foxhoundn <[email protected]>
Yes, I've addressed the feedback about the missing Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Can you do more components? There is still 30+ left. |
…lection components Co-authored-by: Foxhoundn <[email protected]>
Absolutely! I've continued the work and fixed 4 more components in commit 4367736:
That brings us to 11 components completed out of ~40 total. I'm working systematically through the component library, applying the same |
|
@copilot yes please, continue with 10 more |
…mns components Co-authored-by: Foxhoundn <[email protected]>
Co-authored-by: Foxhoundn <[email protected]>
Done! I've completed 10 more components as requested in commits fcf0468 and aea289e: Batch 1 (6 components):
Batch 2 (4 components):
That brings us to 21 components completed out of ~40 total. The remaining major components include Button, Panel, Tag, and Table components. Should I continue with the next batch? |
|
@copilot yes, please. continue |
Co-authored-by: Foxhoundn <[email protected]>
Co-authored-by: Foxhoundn <[email protected]>
Continuing! I've made good progress and completed 3 more components in commits 9423102 and 9ede684: Latest batch:
That brings us to 24 components completed (60% progress). The remaining major components are Button, Panel, Tag main component, and Table sub-components (cell, header, row). These are more complex with many styling props, but I'm working through them systematically. |
|
@copilot please do more components |
…t, InternalPopover, Message, and Notifications components
…, Columns, ControlGroup, Effect, InternalPopover, Notifications, and Table components
…eader to improve prop handling and prevent unwanted prop forwarding
Fixes React DOM warnings caused by styled-components passing styling-only props to underlying DOM elements. Updated components to use the
$prefix convention for transient props that should not be passed through to the DOM.Problem
Styled-components was passing all props to underlying DOM elements, causing React to throw warnings for props that don't exist on DOM elements. This occurred because styled-components by default forwards all props to the wrapped component unless they are prefixed with
$.Example warning:
Solution
Updated styled-components to use the
$prefix convention for props that are only used for styling logic and should not be passed to DOM elements. This follows the styled-components v5.1+ recommendation.Before:
After:
Components Fixed
COMPLETED FILES (24 components with multiple styled components):
item.tsx,list.tsx,index.tsx,content.tsx) - Fixed styling props likedisabled,vertical,fill,padded,sizeposition,transparent,rounded,isResizable*fluid,minimal,readOnly,disabled,pillhorizontal,vertical,width,heightfluid,fixed,minimal, etc.)withSidebar)wrap,fluid,gapSize,align)isPinned,rounded,size)Impact
Pattern for Remaining Work
This PR establishes the pattern for fixing the remaining components in the codebase:
$prefix to those props in TypeScript interfaces$prefixed props$prefixed propswidth,height,className) and styled-components special props (theme,as) without prefixThe foundation is now in place for completing this work across the entire component library.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.