-
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
DataViews: remove reset values from filters #55839
Conversation
Size Change: -39 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@@ -37,6 +37,10 @@ const defaultConfigPerViewType = { | |||
}, | |||
}; | |||
|
|||
// DEFAULT_STATUSES is intentionally sorted. Items do not have spaces in between them. | |||
// The reason for that is to match the default statuses coming from the endpoint (entity request). | |||
export const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All statuses but 'trash'. |
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.
By changing this string (e.g.: remove one of the items), two requests will be dispatched to the pages endpoint (this is how to test that this is working as expected). The same will happen if the site provides custom statuses.
resetValue: defaultStatuses, | ||
}, | ||
], | ||
filters: [ 'enumeration' ], |
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.
After these changes to the filters API as well as others that are in-flight at the moment, my next step would be to clean up this a bit. It'll be now slimmer (there is no longer a need for filters to be objects, for example).
Flaky tests detected in 8c4a993. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6744122906
|
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.
Really cool change. I like how this cleans things a little bit.
This introduced a bug that #55856 fixes. |
Part of #55083
What?
Updates the filters for they to use the same default value (empty string). It's the consumer's responsibility to handle the how that default value is converted to a REST API call.
Why?
This has a double effect:
How?
It's the consumer responsibility to handle the situation in which no value is selected for the filter. In some cases, this would mean to use the REST API defaults (
author
filter), in some other cases it'd mean to provide different defaults (status
filter).Testing Instructions