Skip to content

Editor: Show the actions of the single context in the post actions menu - #85184

Closed
jorgefilipecosta wants to merge 1 commit into
trunkfrom
fix/post-actions-single-context
Closed

jorgefilipecosta wants to merge 1 commit into
trunkfrom
fix/post-actions-single-context

Conversation

@jorgefilipecosta

Copy link
Copy Markdown
Member

What?

Follow up to #84660.

  • Actions registered with context: 'single' now show in the editor's actions menu (the post card panel in the document sidebar), and only there.

Why?

PostActions called usePostActions() without a context, and its filter drops every action that has one. So an action with context: 'single' showed on no screen, while context: 'list' correctly showed only in the DataViews lists. The server registry accepts single as a supported value, so a plugin could register an editor-only action that never appears. Found while testing the server actions API on #83537 (comment).

How?

  • PostActions asks for the actions of the single context.
  • Updates the outdated comment in usePostActions, which said list was the only supported context.
  • Adds unit tests for the context filter of usePostActions, and checks that PostActions requests the single context.

Testing

  1. Add the plugin from Register entity actions in the server #83537 (comment) to wp-content/plugins/demo-page-action/ and activate it.
    In demo-page-action.php, add 'context' => 'single' to the demo-page-details action ("Page details…").
  2. Edit a page and open the ⋮ menu in the document sidebar. Verify "Page details…" shows (it's context: 'single') and "Show ID" doesn't (it's context: 'list'). On trunk, "Page details…" is missing.
  3. Go to Site Editor > Pages, open a page's ⋮ menu, and verify "Show ID" shows and "Page details…" doesn't.
  4. Verify the tests pass:
npm run test:unit -- packages/editor/src/components/post-actions

AI assistance: code, tests, and this description drafted with AI assistance and reviewed by me.

PostActions called usePostActions() without a context, so actions registered with `context: 'single'` showed on no screen. Request the `single` context, update the outdated filter comment, and add tests.
@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Oct 20, 2026
@github-actions github-actions Bot added the [Package] Editor /packages/editor label 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>

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: -363 B (0%)

Total Size: 8.97 MB

📦 View Changed
Filename Size Change
build/modules/lazy-editor/index.min.js 15.1 kB -95 B (-0.62%)
build/scripts/block-editor/index.min.js 604 kB -113 B (-0.02%)
build/scripts/edit-site/index.min.js 420 kB -55 B (-0.01%)
build/scripts/editor/index.min.js 614 kB -100 B (-0.02%)

7770542 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric f06eb8e trunk % Change
timeToFirstByte 53.55 ms +4.67% -2.43% 53.8 ms +4.93% -2.23% -0.46%
largestContentfulPaint 92 ms +4.35% -6.52% 88 ms +9.09% -2.27% 4.55%
lcpMinusTtfb 34.3 ms +18.8% -4.81% 34.2 ms +11.99% -7.89% 0.29%
wpBeforeTemplate 28.21 ms +3.76% -1.31% 28.51 ms +4.24% -1.58% -1.05%
wpTemplate 21.24 ms +4.71% -4.9% 21.18 ms +4.39% -1.13% 0.28%
wpTotal 49.81 ms +5.06% -2.25% 49.92 ms +5.89% -1.8% -0.22%
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 f06eb8e trunk % Change
timeToFirstByte 46.3 ms +8.64% -1.94% 45.95 ms +5.33% -3.05% 0.76%
largestContentfulPaint 100 ms +2% -2% 96 ms +4.17% -0% 4.17%
lcpMinusTtfb 53.15 ms +1.69% -3.76% 51.6 ms +1.84% -2.23% 3%
wpBeforeTemplate 26.78 ms +7.06% -1.76% 26.22 ms +8.73% -0.95% 2.14%
wpTemplate 16.58 ms +6.45% -3.56% 16.16 ms +3.34% -3.22% 2.6%
wpTotal 43.11 ms +9.67% -1.07% 42.76 ms +5.75% -2.5% 0.82%
wpMemoryUsage 6.33 MB +0% -0% 6.30 MB +0% -0% 0.57%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric f06eb8e trunk % Change
mediaProcessingJpeg 401.23 ms +4.02% -1.86% 401.11 ms +1.15% -1.02% 0.03%
mediaProcessingAvif 6070.9 ms +1.58% -0.17% 6092.97 ms +0.16% -0.09% -0.36%
mediaProcessingJpegToAvif 4199.97 ms +1.26% -0.42% 4205.78 ms +0.38% -0.04% -0.14%

media-upload

Metric f06eb8e trunk % Change
jpegUploadProcessing 1951.19 ms +2.12% -1% 1942.94 ms +0.32% -0.86% 0.42%
pngUploadProcessing 226.62 ms +6.98% -18.92% 223.55 ms +13.25% -22.81% 1.37%
largeJpegUploadProcessing 1944.5 ms +1.95% -0.51% 1938.17 ms +0.46% -0.37% 0.33%
multipleImageUploadProcessing 2020.38 ms +1.6% -0.86% 2049.25 ms +0.99% -1.23% -1.41%

post-editor

Metric f06eb8e trunk % Change
serverResponse 513.77 ms +2.15% -3.92% 522.38 ms +3.18% -6.23% -1.65%
firstPaint 456.01 ms +14.02% -40.42% 488.22 ms +4.78% -44.28% -6.6%
domContentLoaded 1202.42 ms +1% -2.19% 1203.65 ms +1.51% -1.59% -0.1%
loaded 1203.52 ms +1.01% -2.16% 1205 ms +1.49% -1.62% -0.12%
firstContentfulPaint 487.88 ms +7.37% -7.23% 507.79 ms +3.71% -1.16% -3.92%
firstBlock 3745.01 ms +2.49% -1.8% 3753.07 ms +3.81% -2.41% -0.21%
type 19.7 ms +3.25% -4.37% 18.92 ms +6.61% -4.18% 4.12%
typeWithoutInspector 19.38 ms +7.79% -3.97% 20.34 ms +3.93% -7.42% -4.72%
typeWithTopToolbar 24.44 ms +2.37% -6.01% 23.16 ms +2.42% -4.02% 5.53%
typeContainer 9.14 ms +6.35% -7.77% 9.25 ms +4.43% -5.19% -1.19%
focus 123.85 ms +12.55% -3.49% 118.67 ms +4.37% -3.48% 4.37%
firstFocus 241.57 ms +0% -0% 247.1 ms +0% -0% -2.24%
selectAll 594.61 ms +3.66% -2.89% 571.74 ms +3.69% -0.81% 4%
listViewOpen 88.58 ms +10.58% -7.79% 81.23 ms +7.69% -5% 9.05%
inserterOpen 43.06 ms +10.45% -13.61% 44.54 ms +5.95% -12.66% -3.32%
inserterHover 12.11 ms +6.36% -6.69% 12.43 ms +5.31% -9.17% -2.57%
inserterSearch 8.69 ms +3.22% -5.87% 7.95 ms +14.09% -8.93% 9.31%
loadPatterns 660.98 ms +2.68% -1.68% 667.25 ms +3.67% -1.38% -0.94%
wpTotal 504.1 ms +2.11% -4.04% 512.11 ms +3.31% -6.15% -1.56%
wpMemoryUsage 14.66 MB +0% -0% 14.63 MB +0% -0% 0.25%
wpDbQueries 54.5 +0.92% -0.92% 55 +0% -1.82% -0.91%

site-editor

Metric f06eb8e trunk % Change
serverResponse 483.83 ms +2.18% -5.32% 478.02 ms +7.65% -5.46% 1.22%
firstPaint 271.21 ms +78.34% -11.46% 246.06 ms +10.71% -2.64% 10.22%
domContentLoaded 1241.07 ms +1.07% -0.33% 1266.94 ms +1.59% -3.45% -2.04%
loaded 1242.19 ms +1.05% -0.35% 1267.87 ms +1.61% -3.45% -2.03%
firstContentfulPaint 503.88 ms +2.46% -3.4% 493.44 ms +7.87% -2.71% 2.12%
firstBlock 4801.24 ms +1.38% -0.39% 4805.8 ms +1.1% -1.23% -0.09%
type 18.76 ms +17.86% -5.28% 17.77 ms +3.83% -5.51% 5.57%
navigate 119.18 ms +8.42% -3.01% 118.29 ms +15% -1.7% 0.75%
loadPatterns 1246.38 ms +3.14% -12.87% 1276.21 ms +4.12% -6.43% -2.34%
loadPages 1036.29 ms +2.38% -2.11% 1013.06 ms +4.4% -1.57% 2.29%
wpTotal 474.51 ms +2.16% -5.44% 468.38 ms +7.82% -5.43% 1.31%
wpMemoryUsage 12.70 MB +0% -0% 12.66 MB +0% -0% 0.29%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

7770542 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-20T11:35:53", "date_gmt": "2026-10-20T11:35:53", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/dd097f19-36a2-45e7-86d6-658ad5ed528d.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/dd097f19-36a2-45e7-86d6-658ad5ed528d.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "dd097f19-36a2-45e7-86d6-658ad5ed528d.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/dd097f19-36a2-45e7-86d6-658ad5ed528d.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/dd097f19-36a2-45e7-86d6-658ad5ed528d.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-20T11:35:53", "modified_gmt": "2026-10-20T11:35:53", "ping_status": "closed", "post": 222, "slug": "dd097f19-36a2-45e7-86d6-658ad5ed528d", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/dd097f19-36a2-45e7-86d6-658ad5ed528d.png", "status": "inherit", "template": "", "title": {"rendered": "dd097f19-36a2-45e7-86d6-658ad5ed528d"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45

7770542 Run

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

Labels

[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant