-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Move usePostFields to wordpress/editor package
#67024
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
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. |
| name: string; | ||
| } | ||
|
|
||
| function usePostFields(): UsePostFieldsReturn { |
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.
Instead of keeping the list of fields here, should we transform this to a "registration API" like actions and start opening the API in Gutenberg? Separate thing obviously, but just want to start this discussion.
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 is actually a relevant question for this PR: usePostActions is defined in the editor package; but I'm operating under the assumption that we want both to live in wordpress/fields at some point, that's why I'm moving it here. Is that your thinking as well?
After that, yeah, field registration would be nice. Probably private to Gutenberg for now?
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.
yeah usePostActions or more precisely for me getEntityActions selector lives in the editor package, mostly because creating new stores is not an easy task and also shouldn't be done at all for bundled packages. So temporarily, the store lives in the editor package. I think we should ultimately do the same for fields.
And when we decide to make things more public (make the fields package non bundled), we should probably move the store to the fields package.
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.
yeah usePostActions or more precisely for me getEntityActions selector lives in the editor package, mostly because creating new stores is not an easy task and also shouldn't be done at all for bundled packages. So temporarily, the store lives in the editor package. I think we should ultimately do the same for fields.
ok, so this means that, for now, we should move usePostFields to the editor package in preparation for adding extensibility. Later, when fields is public will move both to this package.
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.
That's a good plan. Do you think we should also add the postType as param here or in a follow up?
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.
Moved to editor at 1b76327
That's a good plan. Do you think we should also add the postType as param here or in a follow up?
It's best to do it when we add support for other post types.
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.
#67175 to pull the fields from the registry
|
Size Change: -23 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 1b76327. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11854674176
|
usePostFields to wordpress/fields packageusePostFields to wordpress/editor package
Part of #61084
What?
This PR finalizes moving the
usePostFieldshook fromedit-siteto thefieldspackage.Why?
This is the API we want to promote to consumers, they shouldn't have to work with fields individually.
How?
After having move all the fields individually (title, author, date, status, comment_status), this PR just moves the hook.
Testing Instructions
Smoke tests the Pages page, both dataviews and quickedit/dataform.