Skip to content

Block Editor: PR 59: Clean up the types of the converted components - #85213

Merged
manzoorwanijk merged 4 commits into
refactor/block-editor-typescript-check-jsfrom
fix/block-editor-ineffective-prop-types
Oct 20, 2026
Merged

manzoorwanijk merged 4 commits into
refactor/block-editor-typescript-check-jsfrom
fix/block-editor-ineffective-prop-types

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

What?

See #67691. Part of the effort to convert @wordpress/block-editor to TypeScript, stacked on #85036. Follow up to #84848 and #84875.

Cleans up the types of the converted components: leaves ineffective props out, types the color lookups by the fields they read, and drops @wordpress/components types where a plain type does.

Why?

Review of the conversion found props that do nothing, such as min on LineHeightControl (comment), lookups that required full Color objects (comment), and coupling to @wordpress/components types that makes a @wordpress/ui migration harder (comment).

How?

  • Omits the props seven controls always override: dddf64f
  • Makes the color lookups generic over the fields they read: 693eeda
  • Declares the alignment matrix value and the link control click handlers locally: 8d7fb96
  • Keeps the @wordpress/components types of props the components forward to the wrapped component, such as popoverProps and icons, since narrowing them would reject calls that work.

No runtime changes.

Testing Instructions

  1. npm run test:unit -- packages/block-editor/src/components/colors
  2. npm run clean:package-types && npm run typecheck

Use of AI Tools

Written with Claude Code, reviewed by me.

@manzoorwanijk manzoorwanijk added [Type] Code Quality Issues or PRs that relate to code quality [Package] Block editor /packages/block-editor labels Oct 20, 2026
@manzoorwanijk manzoorwanijk self-assigned this Oct 20, 2026
@manzoorwanijk
manzoorwanijk requested a review from ciampo October 20, 2026 16:51
@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: manzoorwanijk <manzoorwanijk@git.wordpress.org>
Co-authored-by: ciampo <mciampini@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: 9.05 MB

abb94cb Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric ce174b2 trunk % Change
timeToFirstByte 56.35 ms +5.24% -4.61% 55 ms +7.27% -4.82% 2.45%
largestContentfulPaint 96 ms +4.17% -2.08% 92 ms +8.7% -2.17% 4.35%
lcpMinusTtfb 41.3 ms +4.84% -13.68% 39.9 ms +8.4% -11.03% 3.51%
wpBeforeTemplate 29.44 ms +8.8% -3.57% 28.88 ms +13.23% -2.94% 1.94%
wpTemplate 22.57 ms +5.1% -5.1% 21.84 ms +3.3% -5.77% 3.34%
wpTotal 52.38 ms +5.63% -4.7% 51.17 ms +6.9% -4.71% 2.36%
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 ce174b2 trunk % Change
timeToFirstByte 43 ms +5.81% -1.4% 46.35 ms +8.41% -1.29% -7.23%
largestContentfulPaint 92 ms +2.17% -0% 102 ms +1.96% -1.96% -9.8%
lcpMinusTtfb 49.2 ms +1.22% -4.17% 53.85 ms +2.69% -0.37% -8.64%
wpBeforeTemplate 27.02 ms +8.73% -1.78% 26.57 ms +3.69% -1.73% 1.69%
wpTemplate 12.85 ms +4.9% -4.98% 16.79 ms +4.05% -1.85% -23.47%
wpTotal 40.05 ms +6.39% -1.92% 43.2 ms +8.8% -1.04% -7.29%
wpMemoryUsage 6.22 MB +0% -0% 6.30 MB +0% -0% -1.19%
wpDbQueries 9 +0% -0% 13 +0% -0% -30.77%

media-processing

Metric ce174b2 trunk % Change
mediaProcessingJpeg 403.11 ms +0.28% -0.21% 401.62 ms +4.54% -0.97% 0.37%
mediaProcessingAvif 6183.16 ms +0.45% -0.26% 6165.97 ms +0.31% -0.12% 0.28%
mediaProcessingJpegToAvif 4263.93 ms +0.02% -0.07% 4250.83 ms +0.16% -0.09% 0.31%

media-upload

Metric ce174b2 trunk % Change
jpegUploadProcessing 1943.12 ms +2.22% -0.71% 1936.02 ms +0.29% -0.57% 0.37%
pngUploadProcessing 235.15 ms +18.43% -22.4% 178.01 ms +19.63% -1.79% 32.1%
largeJpegUploadProcessing 1929.96 ms +0.48% -0.39% 1935.39 ms +0.81% -0.47% -0.28%
multipleImageUploadProcessing 2014.21 ms +1.02% -0.45% 2029.74 ms +0.71% -0.94% -0.77%

post-editor

Metric ce174b2 trunk % Change
serverResponse 284.67 ms +5.61% -4.32% 278.11 ms +2.39% -8.24% 2.36%
firstPaint 185.64 ms +95.18% -26.62% 247.42 ms +39.13% -38.51% -24.97%
domContentLoaded 792.11 ms +0.82% -2.65% 759.51 ms +1.76% -2.06% 4.29%
loaded 793.21 ms +0.81% -2.66% 760.35 ms +1.76% -2.01% 4.32%
firstContentfulPaint 358.77 ms +2.44% -2.12% 349.24 ms +1.79% -1.92% 2.73%
firstBlock 2366.26 ms +3.87% -1.04% 2277.67 ms +1.73% -2.94% 3.89%
type 15.11 ms +7.28% -3.77% 13.57 ms +2.51% -2.73% 11.35%
typeWithoutInspector 15.76 ms +6.28% -6.85% 13.71 ms +5.03% -5.03% 14.95%
typeWithTopToolbar 17.87 ms +5.82% -1.57% 18.85 ms +2.28% -4.99% -5.2%
typeContainer 6.55 ms +10.69% -2.44% 6.6 ms +5.3% -5.15% -0.76%
focus 83.51 ms +6.41% -1.33% 80.35 ms +5.36% -6.01% 3.93%
firstFocus 175.35 ms +0% -0% 139.75 ms +0% -0% 25.47%
selectAll 363.63 ms +4.03% -3.36% 381.52 ms +2.34% -5.18% -4.69%
listViewOpen 58.35 ms +5.59% -13.66% 54.23 ms +8.56% -11.45% 7.6%
inserterOpen 31.64 ms +14.19% -2.88% 26.21 ms +8.97% -8.81% 20.72%
inserterHover 9.37 ms +8.64% -3.74% 8.55 ms +7.95% -5.85% 9.59%
inserterSearch 6.81 ms +3.23% -5.58% 6.21 ms +16.43% -3.38% 9.66%
loadPatterns 451.27 ms +2.18% -1.37% 414.35 ms +2.44% -1.06% 8.91%
wpTotal 277.39 ms +5.49% -4.52% 270.79 ms +2.28% -8.5% 2.44%
wpMemoryUsage 14.66 MB +0% -0% 14.63 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric ce174b2 trunk % Change
serverResponse 312.96 ms +1.94% -7.23% 322.04 ms +1.67% -5.7% -2.82%
firstPaint 236.11 ms +65.25% -20.66% 217.19 ms +13.81% -18.94% 8.71%
domContentLoaded 990.27 ms +1.15% -1.17% 1010.15 ms +2.61% -1.07% -1.97%
loaded 991.38 ms +1.13% -1.2% 1011.38 ms +2.6% -1.1% -1.98%
firstContentfulPaint 398.55 ms +8.06% -2.1% 421.93 ms +1.79% -1.89% -5.54%
firstBlock 3710.66 ms +2.69% -1.96% 3829.03 ms +1.29% -1.48% -3.09%
type 17.25 ms +4.58% -5.45% 18.14 ms +3.09% -5.4% -4.91%
navigate 101.28 ms +8.63% -10.9% 107.29 ms +13.12% -7.9% -5.6%
loadPatterns 1006.58 ms +5.4% -9.78% 1065.85 ms +6.42% -8.8% -5.56%
loadPages 1081.99 ms +2.24% -11% 1087.23 ms +1.27% -2.66% -0.48%
wpTotal 304.71 ms +1.98% -7.34% 313.91 ms +1.67% -5.79% -2.93%
wpMemoryUsage 12.70 MB +0% -0% 12.66 MB +0% -0% 0.29%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

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

abb94cb Run

@manzoorwanijk manzoorwanijk changed the title Block Editor: Leave ineffective props out of the control types and type the color lookups by the fields they read Block Editor: PR 59: Clean up the types of the converted components Oct 20, 2026
@manzoorwanijk
manzoorwanijk changed the base branch from trunk to refactor/block-editor-typescript-check-js October 20, 2026 17:03
@manzoorwanijk
manzoorwanijk added this pull request to stack #84617 October 20, 2026 17:03
@manzoorwanijk
manzoorwanijk force-pushed the fix/block-editor-ineffective-prop-types branch from 355a290 to 7f0384b Compare October 20, 2026 17:05
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review October 20, 2026 20:16
@manzoorwanijk
manzoorwanijk force-pushed the fix/block-editor-ineffective-prop-types branch from 8d7fb96 to abb94cb Compare October 20, 2026 20:36
@manzoorwanijk
manzoorwanijk merged commit b1ee696 into trunk Oct 20, 2026
164 of 204 checks passed
@manzoorwanijk
manzoorwanijk deleted the fix/block-editor-ineffective-prop-types branch October 20, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants