-
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
DataViews: remove the enumeration
type as redundant
#60084
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -19 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
b0abc16
to
52c2f1f
Compare
isPrimary, | ||
} ); | ||
} | ||
const isPrimary = !! field.filterBy?.isPrimary; |
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.
No change here other than un-indentation from removing the switch.
@@ -28,7 +23,7 @@ const Filters = memo( function Filters( { | |||
const addFilterRef = useRef(); | |||
const filters = []; | |||
fields.forEach( ( field ) => { | |||
if ( ! field.type ) { | |||
if ( ! field.elements?.length ) { |
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 check was already in place, just after the type.
52c2f1f
to
b55e345
Compare
Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Part of #55083
Related #55100
What?
Removes the
enumeration
field type.Why?
The
enumeration
type is too coarse for what we want to achieve with field types. We haven't ran into issues yet because we haven't implemented other features (editing).Two concrete examples were we could use a more fine-grained type system are:
type: enumeration
fields are actually different things. For example, status is a string but author is a number.I plan to introduce other types soon to support other kind of filters as this one.
How?
Testing Instructions
Go to any of the dataviews-powered pages (Site Editor > Pages > Manage all pages, Site editor > Patterns, Site Editor > Patterns > Manage template parts, Site Editor > Templates) and verify filters still work as expected.