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
DataViews: update names for DropdownMenuRadioItemCustom
#57416
Conversation
@@ -117,7 +117,7 @@ export default function AddFilter( { filters, view, onChangeView } ) { | |||
return ( | |||
<DropdownMenuRadioItemCustom | |||
key={ element.value } | |||
name={ `add-filter-${ filter.field.id }` } | |||
name={ `add-filter-${ filter.field }` } |
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.
This rendered add-filter-undefined
and now it renders add-filter-author
(for the author
filter).
@@ -172,7 +172,7 @@ export default function AddFilter( { filters, view, onChangeView } ) { | |||
] ) => ( | |||
<DropdownMenuRadioItem | |||
key={ key } | |||
name={ `add-filter-${ filter.name }-conditions` } | |||
name={ `add-filter-${ filter.field }-conditions` } |
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.
This rendered add-filter-Author-conditions
and now it renders add-filter-author-conditions
. Note that fields could have names such as Author Name
, so I thought it best to use the id.
@@ -28,7 +28,10 @@ const radioCheck = ( | |||
* component, which allows deselecting selected values. | |||
*/ | |||
export const DropdownMenuRadioItemCustom = forwardRef( | |||
( { checked, name, value, onChange, onClick, ...props }, ref ) => { | |||
function DropdownMenuRadioItemCustom( |
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.
React devtools will show DropdownMenuRadioItemCustom
if we pass a named function to forwardRef
.
Size Change: -2 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
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.
Thank you for the follow-up!
Part of #55083
What?
Update the
name
attribute in use forDropdownMenuRadioItemCustom
as well as use a named function for the forwarded component.Why?
undefined
or use a key that can contain spaces.