Repository navigation
Actions API: Remove the unsupported single action context - #85186
Conversation
🤖 PR meta 🤖🎉 PropsIf 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. Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: 0 B Total Size: 8.98 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
|
I've taken a look and this is what I've found:
|
|
What's the reason for using |
Removes `single` from the `context` values the entity actions registry supports, leaving `list`. No screen shows the actions of the `single` context, so an action registered with it showed nowhere. Removing it before 7.2 ships keeps the option to add it later with a defined meaning. An action registered with `single` is now reported with `_doing_it_wrong()`, like any other unsupported value, and `single` is no longer in the `context` enum of the `/wp/v2/entity-actions` schema. Developed in #14545. Synced from WordPress/gutenberg#85186. Follow-up to [64517]. Props jorgefilipecosta, oandregal. See #66343. git-svn-id: https://develop.svn.wordpress.org/trunk@64601 602fd350-edb4-49c9-b593-d223f7449a82
Removes `single` from the `context` values the entity actions registry supports, leaving `list`. No screen shows the actions of the `single` context, so an action registered with it showed nowhere. Removing it before 7.2 ships keeps the option to add it later with a defined meaning. An action registered with `single` is now reported with `_doing_it_wrong()`, like any other unsupported value, and `single` is no longer in the `context` enum of the `/wp/v2/entity-actions` schema. Developed in WordPress/wordpress-develop#14545. Synced from WordPress/gutenberg#85186. Follow-up to [64517]. Props jorgefilipecosta, oandregal. See #66343. Built from https://develop.svn.wordpress.org/trunk@64601 git-svn-id: http://core.svn.wordpress.org/trunk@63751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Hi @Mamaduka, just to make sure it is part of the next gutenberg release in core but I should have have used "Backport to 7.2 Beta/RC", it has a small type change so ideally it goes to the wp/7.2 branch. |
No screen shows the actions with `context: 'single'`, so the entity actions registry now reports that value like any other unsupported one, and the REST schema no longer lists it.
No screen shows the actions with `context: 'single'`, and the server no longer supports it. Update the type, its docs, and the README, and add a changelog entry.
|
Can we merge this to fix failing tests on trunk? |
3496911 to
4aff3a3
Compare
Hi @manzoorwanijk thank you for raising awareness it is merged. |
|
I just cherry-picked this PR to the wp/7.2 branch to get it included in the next release: ef23fb3 |
What?
Follow up to #84650.
singlefrom thecontextvalues of an action, leavinglist: in the DataViewsActiontype and README, and in the server entity actions registry.singleaction context wordpress-develop#14545Why?
singlecame from the DataViewsActiontype, which describescontextas "only a meta information for now". No screen shows the actions of that context:PostActionscallsusePostActions()without a context, so it keeps only the actions without one, and the lists keeplist. A plugin could register an action withcontext => 'single'and get no notice, but the action would show nowhere. Removing it before WordPress 7.2 ships keeps the option to add it later with a defined meaning.This replaces #85184, which made the editor's actions menu show
singleactions instead.How?
WP_Entity_Actions_Registry::SUPPORTED_VALUES['context']toarray( 'list' ), sosingleis reported with_doing_it_wrong(), like any other unsupported value.singlefrom thecontextenumof the/wp/v2/entity-actionsschema.Action['context']type to'list', documents what it does in the type and the README, and adds a breaking change entry to the DataViews changelog. DataViews itself never readcontext; no Gutenberg, WooCommerce, or Jetpack action setssingle.singleas the unsupported context in the invalid values test.Testing
'context' => 'single'onwp_entity_actions_api_initand verify a_doing_it_wrong()notice names it ("context is not one of list.").contextproperty ofOPTIONS /wp/v2/entity-actionsonly listslist.npm run typecheck -- packages/dataviewspasses, and that an action withcontext: 'single'is now a type error.npm run test:unit:php -- --filter test_registering_an_action_with_invalid_values_is_reported.AI assistance: code, tests, and this description drafted with AI assistance and reviewed by me.