Skip to content

Actions API: Remove the unsupported single action context - #85186

Merged
jorgefilipecosta merged 3 commits into
trunkfrom
remove/entity-actions-single-context
Oct 20, 2026
Merged

jorgefilipecosta merged 3 commits into
trunkfrom
remove/entity-actions-single-context

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What?

Follow up to #84650.

Why?

single came from the DataViews Action type, which describes context as "only a meta information for now". No screen shows the actions of that context: PostActions calls usePostActions() without a context, so it keeps only the actions without one, and the lists keep list. A plugin could register an action with context => '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 single actions instead.

How?

  • Sets WP_Entity_Actions_Registry::SUPPORTED_VALUES['context'] to array( 'list' ), so single is reported with _doing_it_wrong(), like any other unsupported value.
  • Removes single from the context enum of the /wp/v2/entity-actions schema.
  • Narrows the DataViews 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 read context; no Gutenberg, WooCommerce, or Jetpack action sets single.
  • Uses single as the unsupported context in the invalid values test.

Testing

  1. Register an action with 'context' => 'single' on wp_entity_actions_api_init and verify a _doing_it_wrong() notice names it ("context is not one of list.").
  2. Verify the context property of OPTIONS /wp/v2/entity-actions only lists list.
  3. Verify npm run typecheck -- packages/dataviews passes, and that an action with context: 'single' is now a type error.
  4. Run 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.

@jorgefilipecosta jorgefilipecosta added [Type] Code Quality Issues or PRs that relate to code quality [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta [Feature] Extensibility The ability to extend blocks or the editing experience and removed Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

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 props-bot label to refresh.

📦 Bundle size

Size Change: 0 B

Total Size: 8.98 MB

4aff3a3 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric edbb9cd trunk % Change
timeToFirstByte 52.8 ms +16.48% -2.56% 54.75 ms +11.42% -4.57% -3.56%
largestContentfulPaint 92 ms +4.35% -6.52% 96 ms +4.17% -8.33% -4.17%
lcpMinusTtfb 34.5 ms +18.99% -5.07% 35.45 ms +17.21% -6.21% -2.68%
wpBeforeTemplate 28.44 ms +19.8% -1.76% 28.54 ms +20.6% -2.03% -0.35%
wpTemplate 20.6 ms +6.46% -3.3% 21.03 ms +3.33% -5.47% -2.04%
wpTotal 49.04 ms +16.07% -2.32% 51.14 ms +10.5% -5.61% -4.11%
wpMemoryUsage 7.64 MB +0% -0% 7.61 MB +0% -0% 0.46%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric edbb9cd trunk % Change
timeToFirstByte 45.35 ms +6.06% -1.21% 45.15 ms +3.54% -1.77% 0.44%
largestContentfulPaint 100 ms +4% -0% 100 ms +2% -4% 0%
lcpMinusTtfb 55.1 ms +0.82% -0.82% 52.75 ms +4.83% -1.8% 4.45%
wpBeforeTemplate 26.33 ms +2.81% -1.29% 26.01 ms +1.96% -1.19% 1.23%
wpTemplate 15.85 ms +3.47% -1.32% 15.81 ms +2.34% -2.59% 0.25%
wpTotal 42.3 ms +5.74% -1.02% 42.3 ms +3.26% -2.27% 0%
wpMemoryUsage 6.33 MB +0% -0% 6.30 MB +0% -0% 0.57%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric edbb9cd trunk % Change
mediaProcessingJpeg 397.1 ms +1.34% -0.2% 400.46 ms +0.75% -0.36% -0.84%
mediaProcessingAvif 6049.81 ms +0.42% -0.37% 6058.48 ms +0.18% -0.21% -0.14%
mediaProcessingJpegToAvif 4161.9 ms +0.16% -0.1% 4177.13 ms +0.07% -0.07% -0.36%

media-upload

Metric edbb9cd trunk % Change
jpegUploadProcessing 1442.09 ms +36.27% -1.85% 1420.78 ms +0.73% -0.84% 1.5%
pngUploadProcessing 188.1 ms +4.23% -7.44% 180.62 ms +1.75% -1.76% 4.14%
largeJpegUploadProcessing 1418.77 ms +0.27% -0.57% 1408.38 ms +0.69% -0.52% 0.74%
multipleImageUploadProcessing 1545.89 ms +1.66% -0.94% 1571.7 ms +1.73% -0.98% -1.64%

post-editor

Metric edbb9cd trunk % Change
serverResponse 507.41 ms +5.66% -1.37% 499.35 ms +4.28% -2.66% 1.61%
firstPaint 373.92 ms +36.22% -37.78% 277.6 ms +80.83% -25% 34.7%
domContentLoaded 1208.17 ms +2.77% -2.92% 1194.57 ms +1.52% -3.19% 1.14%
loaded 1209.21 ms +2.79% -2.92% 1195.58 ms +1.51% -3.2% 1.14%
firstContentfulPaint 519.3 ms +2.4% -1.92% 506.41 ms +2.82% -2.99% 2.55%
firstBlock 3703.73 ms +3% -2.79% 3700.61 ms +1.75% -2.72% 0.08%
type 17.27 ms +6.2% -1.91% 17.17 ms +3.73% -4.31% 0.58%
typeWithoutInspector 16.99 ms +4.41% -0.35% 16.96 ms +4.07% -4.13% 0.18%
typeWithTopToolbar 23.89 ms +0.38% -4.14% 23.89 ms +4.02% -1.13% 0%
typeContainer 9.18 ms +4.68% -8.39% 8.89 ms +2.14% -4.95% 3.26%
focus 122.2 ms +10.53% -2.86% 120.58 ms +5.06% -4.73% 1.34%
firstFocus 234.23 ms +0% -0% 237.57 ms +0% -0% -1.41%
selectAll 600.29 ms +2.71% -2.61% 586.62 ms +3.76% -2.95% 2.33%
listViewOpen 82.72 ms +7.07% -4.21% 83.22 ms +5.83% -10.79% -0.6%
inserterOpen 44.77 ms +4.87% -15.99% 47.7 ms +19.5% -13.88% -6.14%
inserterHover 12.28 ms +8.06% -9.61% 12.5 ms +2.88% -6.8% -1.76%
inserterSearch 8.27 ms +4.23% -5.56% 8.7 ms +2.87% -5.98% -4.94%
loadPatterns 645.78 ms +5.07% -4.26% 655.82 ms +2.82% -4.16% -1.53%
wpTotal 497.59 ms +5.69% -1.49% 489.1 ms +4.25% -2.69% 1.74%
wpMemoryUsage 14.66 MB +0% -0% 14.63 MB +0% -0% 0.26%
wpDbQueries 55 +0% -1.82% 55 +0% -1.82% 0%

site-editor

Metric edbb9cd trunk % Change
serverResponse 421.21 ms +2.65% -5.87% 387.93 ms +6.36% -0.84% 8.58%
firstPaint 264.19 ms +4.38% -12.91% 243.12 ms +17.99% -5.07% 8.67%
domContentLoaded 1209.38 ms +1.67% -2.51% 1166.38 ms +1.06% -0.4% 3.69%
loaded 1210.42 ms +1.68% -2.51% 1167.23 ms +1.08% -0.37% 3.7%
firstContentfulPaint 493.8 ms +1.42% -2.13% 471.82 ms +3.41% -5.77% 4.66%
firstBlock 4572.44 ms +1.6% -1.2% 4467.8 ms +0.91% -0.81% 2.34%
type 17.65 ms +4.48% -1.53% 18.18 ms +2.86% -2.26% -2.92%
navigate 132.17 ms +2.91% -1.4% 130.9 ms +8.37% -7.37% 0.97%
loadPatterns 1274.68 ms +7.4% -0.68% 1288.38 ms +6.44% -9.47% -1.06%
loadPages 985.64 ms +1.49% -2.86% 987.98 ms +1.87% -2.75% -0.24%
wpTotal 412.07 ms +2.69% -6% 378.82 ms +6.48% -0.95% 8.78%
wpMemoryUsage 12.70 MB +0% -0% 12.66 MB +0% -0% 0.29%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

4aff3a3 Run

🏁 Flaky tests

Some 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 /test/e2e/specs/editor/various/core-settings.spec.js, passed after 1 failed attempt.
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 1
+ Received  + 1

  Array [
    "rewrite_rules",
-   "SERIALIZED DATA",
+   "",
  ]
    at forEach (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:46:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:43:35
refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 1
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "curies": [{"href": "https://api.w.org/{rel}", "name": "wp", "templated": true}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=223"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/223", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}], "wp:attached-to": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/posts/222", "id": 222, "post_type": "post"}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-223", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-10-20T15:37:16", "date_gmt": "2026-10-20T15:37:16", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/786b6726-9c23-422f-9b3c-b74beda667f4.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/786b6726-9c23-422f-9b3c-b74beda667f4.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "786b6726-9c23-422f-9b3c-b74beda667f4.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/786b6726-9c23-422f-9b3c-b74beda667f4.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/786b6726-9c23-422f-9b3c-b74beda667f4.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-10-20T15:37:16", "modified_gmt": "2026-10-20T15:37:16", "ping_status": "closed", "post": 222, "slug": "786b6726-9c23-422f-9b3c-b74beda667f4", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/786b6726-9c23-422f-9b3c-b74beda667f4.png", "status": "inherit", "template": "", "title": {"rendered": "786b6726-9c23-422f-9b3c-b74beda667f4"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45
restores the blocks when a multi-selection drag is canceled in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:871:3

4aff3a3 Run

@oandregal

Copy link
Copy Markdown
Member

I've taken a look and this is what I've found:

  • The context is used so that usePostActions consumers can pull actions selectively:
    • calling it with no context gives you all only actions without context: this is what the editor (inspector) does
    • calling it with list context gives you all actions without context plus the actions with list context: this is all other screens
  • It's not used anywhere by DataViews internally.
  • Only the view-post-revisions action declares context (and it uses list). This makes the action unavailable in the editor but available in any other screen.
  • The single context is not used anywhere.

@jorgefilipecosta jorgefilipecosta added Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) Backported to WP Core Pull request that has been successfully merged into WP Core labels Oct 20, 2026
@Mamaduka

Copy link
Copy Markdown
Member

What's the reason for using Backported to WP Core label? This doesn't require a wp/7.2 branch backport?

wporg-sync pushed a commit to WordPress/wordpress-develop that referenced this pull request Oct 20, 2026
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
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 20, 2026
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
@jorgefilipecosta jorgefilipecosta added the Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Oct 20, 2026
@jorgefilipecosta

Copy link
Copy Markdown
Member Author

What's the reason for using Backported to WP Core label? This doesn't require a wp/7.2 branch backport?

What's the reason for using Backported to WP Core label? This doesn't require a wp/7.2 branch backport?

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.
@manzoorwanijk

Copy link
Copy Markdown
Member

Can we merge this to fix failing tests on trunk?

@jorgefilipecosta
jorgefilipecosta force-pushed the remove/entity-actions-single-context branch from 3496911 to 4aff3a3 Compare October 20, 2026 15:16
@jorgefilipecosta
jorgefilipecosta merged commit cd90ebc into trunk Oct 20, 2026
70 checks passed
@jorgefilipecosta
jorgefilipecosta deleted the remove/entity-actions-single-context branch October 20, 2026 15:18
@jorgefilipecosta

Copy link
Copy Markdown
Member Author

Can we merge this to fix failing tests on trunk?

Hi @manzoorwanijk thank you for raising awareness it is merged.

@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 20, 2026
@github-actions github-actions Bot removed the Backport to WP 7.2 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Oct 20, 2026
@github-actions

Copy link
Copy Markdown

I just cherry-picked this PR to the wp/7.2 branch to get it included in the next release: ef23fb3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) Backported to WP Core Pull request that has been successfully merged into WP Core [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Feature] Extensibility The ability to extend blocks or the editing experience [Package] DataViews /packages/dataviews [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants