-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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]: Rename accessorFn to getValue #55434
Conversation
Size Change: +28 B (0%) Total Size: 1.66 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6a0247e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6557059055
|
const { render, ...column } = field; | ||
column.cell = ( props ) => render( props.row.original, view ); | ||
const { render, getValue, ...column } = field; | ||
column.cell = ( props ) => |
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.
We should also cover against field.render
not existing, e.g.: status.
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 happens in the parent component: https://github.com/WordPress/gutenberg/pull/55434/files#diff-a72d10c309e831c5e03caff0c1b9cfb82885abb105377a196cca642ea4d711adR32
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.
ok, that's confusing 😅 Can we normalize both things in the same place?
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.
A follow-up we may need to do is the following: the tanstack API may use the presence of accessorFn and cell to determine whether a feature is enabled or not
Exactly that. Let's do that in a separate PR and see if we can remove the getValue
completely.
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.
I left a comment I'd like us to address at https://github.com/WordPress/gutenberg/pull/55434/files#r1363355741 Other than that, it's ready.
A follow-up we may need to do is the following: the tanstack API may use the presence of accessorFn
and cell
to determine whether a feature is enabled or not. For example, accessorFn
is used to determine whether a column is filterable. We'd need to review these tanstack details, so they don't leak into our own API.
What?
Small follow up of: #55411
Renames
accessorFn
togetValue
and updates the signature to of both to accept an object, so they can be used as components.Testing Instructions