-
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
Revert changes to Nav Block data fetching mechanics #21721
Conversation
Size Change: +81 B (0%) Total Size: 842 kB
ℹ️ View Unchanged
|
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 have manually tested the functionality around the "Create from all top-level pages" button and that has no regressions and still works well. Can you confirm that's what I was supposed to check here? Otherwise, this seems all good.
I've left two code-style questions/comments
Much appreciated @marekhrabe 🎉🎉🎉🎉🎉
Yeh basically:
Resolve one and the other I'd prefer to handle elsewhere. Let me know if we're still 👍 |
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.
All working well. Thanks for addressing the feedback!
Does this still come with the caveat about contributor users? |
Yes sorry it does. I've updated the PR desc to make this clear. I checked and it's still not possible to overide the const filterDefaultPages = {
parent: 0,
order: 'asc',
orderby: 'id',
context: 'view', // note this will be overridden at https://github.com/WordPress/gutenberg/blob/1c7d80b7ad8025b2cead7866e49103911cf4889a/packages/core-data/src/resolvers.js#L97
};
const pagesSelect = [
'core',
'getEntityRecords',
[ 'postType', 'page', filterDefaultPages ],
]; I suggest we reopen the original issue and then tackle in a new PR. |
@getdave It may also be worth opening a more general ticket to discuss making it possible to override |
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 haven't tested it, but it looks like a valid partial revert of f2b6778.
This PR has been extracted from #21674.
It partially reverts commit f2b6778 (based on PR #18669) which changed the data fetching mechanics for the Navigation Block to use
apiFetch
(via a newuseApiFetch
hook).This PR only reverts the changes to the Nav Block to utilise
useApiFetch
Hook. The deprecation ofuseApiFetch
will be handled in a separate PR.Note this does not solve the issue where Contributor users cannot "Create from top-level Pages" because of the
context
parameter being force set toedit
within the@wordpress/core-data
package. If this were overridable and could be set toview
then this issue would be fixed, but that should be addressed in another PR via a change tocore-data
(cc @nerrad ).See also #21674 (comment)
Description
Reverted the Nav Block data fetch mechanics back to how it was prior to #18669.
How has this been tested?
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: