-
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
API: Replace all withAPIData usage and deprecate the HoC #8584
Conversation
const latestPostsQuery = pickBy( { | ||
categories, | ||
order, | ||
orderby: orderBy, | ||
per_page: postsToShow, | ||
_fields: [ 'date_gmt', 'link', 'title' ], |
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 are going to fetch more data, is that expected?
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.
yes, with a central store like we do right now, we can't fetch a small part of objects, we fetch the whole objects or we don't. Because the redux state always expects the full object.
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 could, but it is super complex :)
Eslint complains
Unit test fails:
Otherwise everything works perfectly fine. |
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.
Awesome 🎉
great one 💯
@@ -40,6 +41,22 @@ async function loadPostTypeEntities() { | |||
} ); | |||
} | |||
|
|||
/** | |||
* Returns the list of the taxonomies entities. |
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.
Nit: The function returns a promise. The promise resolves to a list of the taxonomies entities.
Aside: This is probably one of the only things I dislike about async
/ await
, that it becomes very non-obvious that it will always return a Promise (I think even if the function has no return
statement? My uncertainty reenforces my point 😄 ).
This PR removes the remaining usage of withAPIData from Gutenberg and officially deprecate its usage.
Testing instructions
closes #7397
closes #6277
closes #6379
closes #6537