-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Data views]: Normalize render
fields function
#55411
Conversation
@@ -132,18 +132,12 @@ function ViewList( { | |||
paginationInfo, | |||
} ) { | |||
const columns = useMemo( () => { | |||
const _columns = [ | |||
...fields.map( ( 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.
There was an extra spreading of the array here.
f86f4d5
to
ba56611
Compare
Size Change: +39 B (0%) Total Size: 1.66 MB
ℹ️ View Unchanged
|
Co-authored-by: Miguel Fonseca <[email protected]>
@@ -89,7 +89,7 @@ export default function PagePages() { | |||
id: 'featured-image', | |||
header: __( 'Featured Image' ), | |||
accessorFn: ( page ) => page.featured_media, | |||
render: ( { item, view: currentView } ) => | |||
render: ( item, currentView ) => |
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.
The problem is that this is not a component anymore, I think make it a component have some advantages. So I'd rather change the signature of accessorFn
. In fact I'd rename accessorFn
to something like getValue
or something. accessorFn
is too tanstaky and too confusing to me.
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.
Yeah, I'm planning on doing this today.
What?
Part of: #55083
This PR normalizes the
render
fields function to have similar signature, in order for views to call just one function. I haven't yet removedaccessorFn
since it's used in tanstack(list view) and we have to investigate more before doing so.Testing Instructions