Skip to content

Boost: Migrate Notice to @wordpress/ui - #48171

Merged
vianasw merged 3 commits into
trunkfrom
update/components-notice-use-wp-ui
Apr 19, 2026
Merged

vianasw merged 3 commits into
trunkfrom
update/components-notice-use-wp-ui

Conversation

@vianasw

@vianasw vianasw commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #

Proposed changes

Migrates Jetpack Boost's 11 Notice call sites from the internal @automattic/jetpack-components component to the compound-component Notice from @wordpress/ui.

  • Swap the Notice import for the compound-component Notice namespace from @wordpress/ui.

  • Translate the old flat props into sub-components:

    Old New
    level="error|warning|info|success" intent="error|warning|info|success|neutral" on Notice.Root
    title="X" <Notice.Title>X</Notice.Title>
    children (body) <Notice.Description>…</Notice.Description>
    actions={[…]} <Notice.Actions> wrapping Notice.ActionButton / Notice.ActionLink
    hideCloseButton={true} omit <Notice.CloseIcon>
    onClose={fn} <Notice.CloseIcon onClick={fn} label="Dismiss" />
  • Add "@wordpress/ui": "0.9.0" to projects/plugins/boost/package.json (matches sibling packages).

  • Override webpack's DependencyExtractionPlugin.requestMap to bundle @wordpress/theme and @wordpress/private-apis inline. They're transitive deps of @wordpress/ui that the plugin would otherwise externalize to the wp-theme / wp-private-apis script handles — but wp-theme isn't registered by WP core for plain admin pages, so externalizing it silently breaks the Boost admin bundle enqueue.

Files touched (11 call sites): boost-pricing-table, cornerstone-pages/meta, critical-css/regenerate-critical-css-suggestion, critical-css/show-stopper-error, image-guide, lcp/status/error-details, minify-legacy-notice, module, page-cache/health/error-notices (11 Notices in one file), page-cache/meta, page-cache.

Before:
Screenshot 2026-04-18 at 14 53 57

After:
Screenshot 2026-04-18 at 14 52 22

Related product discussion/links

  • N/A — internal component refactor.

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  1. Check out this branch and run jetpack build plugins/boost --deps.
  2. Visit wp-admin → Jetpack → Boost on a test site.
  3. Confirm the Boost dashboard renders as expected. In particular:
    • Each module card that has worksOffline: false shows the "This module will not work while your website is not publicly available." Notice with the new @wordpress/ui styling (amber warning background, caution icon) when the site is not publicly reachable.
    • Enable Page Cache (or any module) on a site where caching can't be configured, and confirm the error Notice renders with a visible dismiss button.
    • If you have a server without Imagick/GD, enable Image Guide and confirm the "Image resizing is unavailable" Notice renders below the module.
    • Trigger a Critical CSS generation failure to verify the show-stopper error Notice renders with its folding-element contents.
  4. Run pnpm eslint projects/plugins/boost/app/assets/src/js/features — should be clean.

Follow-up: the matching migration for the Jetpack plugin's connection-banner, along with the my-jetpack and protect consumers, plus deletion of the source component from js-packages/components, will land in a separate PR.

Replace the Jetpack-internal Notice component (@automattic/jetpack-components)
with the compound-component Notice from @wordpress/ui across 11 call sites in
Boost. The new API decomposes title/actions/children into Notice.Root /
Notice.Title / Notice.Description / Notice.Actions / Notice.CloseIcon, and
maps level to intent (same vocabulary).

Webpack: bundle @wordpress/theme and @wordpress/private-apis inline — they're
transitive deps of @wordpress/ui but are not registered as script handles in
WP core for plain admin pages, so externalizing them breaks the enqueue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Plugin] Boost A feature to speed up the site and improve performance. label Apr 18, 2026
@github-actions

github-actions Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Apr 18, 2026
@vianasw vianasw added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Apr 18, 2026
@vianasw
vianasw requested a review from a team April 18, 2026 19:05
vianasw added a commit that referenced this pull request Apr 18, 2026
Follow-up to #48171 (Boost migration). Migrates the three non-Boost call
sites of the Jetpack-internal Notice component (from
@automattic/jetpack-components) to the compound-component Notice from
@wordpress/ui:

- Jetpack plugin: _inc/client/components/connection-banner/index.jsx
- Protect: src/js/routes/settings/index.jsx (2 notices)
- Protect: src/js/routes/firewall/index.jsx (1 notice, previously aliased
  as JetpackNotice)

Each call site decomposes title/actions/children into Notice.Root /
Notice.Title / Notice.Description / Notice.Actions / Notice.CloseIcon, and
maps `level` -> `intent` (same vocabulary).

Adds @wordpress/ui 0.11.0 to projects/plugins/protect/package.json (the
Jetpack plugin already had it). Webpack: forces @wordpress/theme to bundle
inline in protect's webpack config and in the Jetpack plugin's
tools/webpack.config.js DependencyExtractionPlugin() call sites.
@wordpress/theme is a transitive dep of @wordpress/ui that isn't
registered as a WP script handle in plain admin contexts, so
externalizing it breaks enqueue. Leaving @wordpress/private-apis
externalized: core's private-apis copy rejects lock() from non-core
modules, but other externalized consumers (@wordpress/dataviews) depend
on sharing the same instance.

The source Notice component in js-packages/components and the my-jetpack
package's three call sites are intentionally left unchanged here.
my-jetpack pulls in @wordpress/dataviews which fights over the
private-apis consent map when @wordpress/theme is bundled inline; that
migration needs dedicated webpack surgery and is out of scope for this
PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@@ -78,6 +78,15 @@ module.exports = [
MiniCssExtractPlugin: {
filename: 'jetpack-boost.css',
},
DependencyExtractionPlugin: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Boost PR's requestMap is a workaround for a WP-core gap (wp-theme isn't a registered handle in plain admin). Without it, the bundle silently doesn't load.

Comment thread projects/plugins/boost/package.json Resolved
vianasw and others added 2 commits April 19, 2026 22:09
Co-authored-by: Mikael Korpela <mikael@ihminen.org>
…tice-use-wp-ui

# Conflicts:
#	pnpm-lock.yaml
#	projects/plugins/boost/package.json
@github-actions

github-actions Bot commented Apr 19, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the update/components-notice-use-wp-ui branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/components-notice-use-wp-ui
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/components-notice-use-wp-ui

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/plugins/boost/app/assets/src/js/features/page-cache/health/error-notices.tsx 0/26 (0.00%) 0.00% 1 ❤️‍🩹
projects/plugins/boost/app/assets/src/js/features/minify-legacy-notice/minify-legacy-notice.tsx 0/4 (0.00%) 0.00% -2 💚

Full summary · PHP report · JS report

@vianasw
vianasw merged commit 2b61e6a into trunk Apr 19, 2026
169 of 173 checks passed
@vianasw
vianasw deleted the update/components-notice-use-wp-ui branch April 19, 2026 21:10
@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Apr 19, 2026
CGastrell pushed a commit that referenced this pull request Apr 28, 2026
Follow-up to #48171 (Boost migration). Migrates the three non-Boost call
sites of the Jetpack-internal Notice component (from
@automattic/jetpack-components) to the compound-component Notice from
@wordpress/ui:

- Jetpack plugin: _inc/client/components/connection-banner/index.jsx
- Protect: src/js/routes/settings/index.jsx (2 notices)
- Protect: src/js/routes/firewall/index.jsx (1 notice, previously aliased
  as JetpackNotice)

Each call site decomposes title/actions/children into Notice.Root /
Notice.Title / Notice.Description / Notice.Actions / Notice.CloseIcon, and
maps `level` -> `intent` (same vocabulary).

Adds @wordpress/ui 0.11.0 to projects/plugins/protect/package.json (the
Jetpack plugin already had it). Webpack: forces @wordpress/theme to bundle
inline in protect's webpack config and in the Jetpack plugin's
tools/webpack.config.js DependencyExtractionPlugin() call sites.
@wordpress/theme is a transitive dep of @wordpress/ui that isn't
registered as a WP script handle in plain admin contexts, so
externalizing it breaks enqueue. Leaving @wordpress/private-apis
externalized: core's private-apis copy rejects lock() from non-core
modules, but other externalized consumers (@wordpress/dataviews) depend
on sharing the same instance.

The source Notice component in js-packages/components and the my-jetpack
package's three call sites are intentionally left unchanged here.
my-jetpack pulls in @wordpress/dataviews which fights over the
private-apis consent map when @wordpress/theme is bundled inline; that
migration needs dedicated webpack surgery and is out of scope for this
PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CGastrell pushed a commit that referenced this pull request Apr 30, 2026
Follow-up to #48171 (Boost migration). Migrates the three non-Boost call
sites of the Jetpack-internal Notice component (from
@automattic/jetpack-components) to the compound-component Notice from
@wordpress/ui:

- Jetpack plugin: _inc/client/components/connection-banner/index.jsx
- Protect: src/js/routes/settings/index.jsx (2 notices)
- Protect: src/js/routes/firewall/index.jsx (1 notice, previously aliased
  as JetpackNotice)

Each call site decomposes title/actions/children into Notice.Root /
Notice.Title / Notice.Description / Notice.Actions / Notice.CloseIcon, and
maps `level` -> `intent` (same vocabulary).

Adds @wordpress/ui 0.11.0 to projects/plugins/protect/package.json (the
Jetpack plugin already had it). Webpack: forces @wordpress/theme to bundle
inline in protect's webpack config and in the Jetpack plugin's
tools/webpack.config.js DependencyExtractionPlugin() call sites.
@wordpress/theme is a transitive dep of @wordpress/ui that isn't
registered as a WP script handle in plain admin contexts, so
externalizing it breaks enqueue. Leaving @wordpress/private-apis
externalized: core's private-apis copy rejects lock() from non-core
modules, but other externalized consumers (@wordpress/dataviews) depend
on sharing the same instance.

The source Notice component in js-packages/components and the my-jetpack
package's three call sites are intentionally left unchanged here.
my-jetpack pulls in @wordpress/dataviews which fights over the
private-apis consent map when @wordpress/theme is bundled inline; that
migration needs dedicated webpack surgery and is out of scope for this
PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CGastrell added a commit that referenced this pull request Apr 30, 2026
* Components: Migrate remaining Notice consumers to @wordpress/ui

Follow-up to #48171 (Boost migration). Migrates the three non-Boost call
sites of the Jetpack-internal Notice component (from
@automattic/jetpack-components) to the compound-component Notice from
@wordpress/ui:

- Jetpack plugin: _inc/client/components/connection-banner/index.jsx
- Protect: src/js/routes/settings/index.jsx (2 notices)
- Protect: src/js/routes/firewall/index.jsx (1 notice, previously aliased
  as JetpackNotice)

Each call site decomposes title/actions/children into Notice.Root /
Notice.Title / Notice.Description / Notice.Actions / Notice.CloseIcon, and
maps `level` -> `intent` (same vocabulary).

Adds @wordpress/ui 0.11.0 to projects/plugins/protect/package.json (the
Jetpack plugin already had it). Webpack: forces @wordpress/theme to bundle
inline in protect's webpack config and in the Jetpack plugin's
tools/webpack.config.js DependencyExtractionPlugin() call sites.
@wordpress/theme is a transitive dep of @wordpress/ui that isn't
registered as a WP script handle in plain admin contexts, so
externalizing it breaks enqueue. Leaving @wordpress/private-apis
externalized: core's private-apis copy rejects lock() from non-core
modules, but other externalized consumers (@wordpress/dataviews) depend
on sharing the same instance.

The source Notice component in js-packages/components and the my-jetpack
package's three call sites are intentionally left unchanged here.
my-jetpack pulls in @wordpress/dataviews which fights over the
private-apis consent map when @wordpress/theme is bundled inline; that
migration needs dedicated webpack surgery and is out of scope for this
PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix CI on #48173: changelog type, webpack indentation, test selector

- Jetpack changelog entry: Type `changed` isn't valid for plugins/jetpack
  (allowed: major, enhancement, compat, bugfix, other). Switch to `other`.
- tools/webpack.config.js: fix prettier/prettier indentation inside the
  DependencyExtractionPlugin requestMap override (the eslint --fix
  reindent).
- connection-banner test: the old test used getByLabelText looking for
  ActionButton's `label` prop. The @wordpress/ui Notice.ActionButton puts
  the text in children; switch to getByRole with accessible name.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Drop @wordpress/theme webpack workaround

The original migration added `@wordpress/theme: { external: false }` to
DependencyExtractionPlugin requestMaps in protect/webpack.config.js and in
two call sites in plugins/jetpack/tools/webpack.config.js, on the theory
that @wordpress/theme is a transitive dep of @wordpress/ui that isn't
registered as a WP script handle in plain admin contexts.

Verified locally: with both files restored to trunk, `jetpack build
plugins/protect` succeeds and the migrated Notices render cleanly on
Protect Settings and Firewall — no console errors, no enqueue failures.
@wordpress/theme is shipped as a script module, not a classic script
handle, so the externalization concern doesn't apply here.

Per @simison's review feedback on #48173.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Address review feedback on Notice migration

- firewall/index.jsx: wrap "Jetpack Firewall is currently disabled."
  in __() so it gets translated (regression introduced when migrating
  away from the old <Notice title=...> prop, which was already passing
  a translated string).
- settings/index.jsx: replace `target="_blank" rel="noreferrer"` on both
  Notice.ActionLink instances with the `openInNewTab` shorthand. It's
  the @wordpress/ui Link API: sets target=_blank under the hood and
  appends the design system's external-link arrow indicator.

Per @simison's review feedback on #48173.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Christian Gastrell <cgastrell@gmail.com>
CGastrell added a commit that referenced this pull request May 8, 2026
…shboard build

The Notice migration introduced a transitive dep on `@wordpress/theme` via
`@wordpress/ui`. The dependency-extraction-webpack-plugin externalized it to
the `wp-theme` script handle, which is not reliably registered as a WP script
in plain admin contexts (e.g., Jurassic Ninja test sites). When `wp-theme` was
missing from `$wp_scripts->registered`, WordPress silently skipped printing
`jp-search-dashboard` -- no script tag, no inline initial state, blank page.

Bundle both `@wordpress/theme` and `@wordpress/private-apis` together so the
module-init `lock()` call lands on the same private-apis consent map. Same
fix as #48173 (Components Notice migration) and #48171 (Boost). The search
dashboard does not pull in `@wordpress/dataviews`, so this does not hit the
my-jetpack collision case described there.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CGastrell added a commit that referenced this pull request May 11, 2026
…48537) (#48550)

* Search: migrate dashboard notices to @wordpress/ui Notice

Replace the local SimpleNotice + NoticeAction wrappers with Notice.* from
@wordpress/ui across the search dashboard:

- record-meter/notice-box: tier notices use Notice.Root/Title/Description
  + Notice.Actions/ActionLink (openInNewTab); the legacy
  jp-search-notice-box__important class becomes intent="error".
- pages/sections/first-run-section: indexing notice uses Notice.Root/Title/
  Description.
- global-notices: snackbar notices use Notice.Root + Notice.Description +
  Notice.CloseIcon, with auto-dismiss preserved via a useEffect timer.
  Status strings remain in the redux store; mapped to wp-ui intents at render.

Drops vestigial fields the redux notice creators never set anyway
(isCompact, isPersistent, displayOnNextPage, notice.button/href).

Deletes the SimpleNotice/NoticeAction sources, their stylesheets, and
notice-box.scss; strips the dead .dops-notice* overrides from
global-notices/style.scss while keeping the snackbar positioning rules.

Removes one site of @automattic/jetpack-components Gridicon usage
(SimpleNotice's icon-wrapper) — helps the broader modernization sweep.

Follow-up to simison review feedback on #48537.

* Search: scope notice-box test queries to render container

`@wordpress/ui` Notice uses `@wordpress/a11y` to announce notice text
via `<div class="a11y-speak-region">` regions appended to
`document.body`. After this PR's migration, the notice copy is in the
DOM twice (in the rendered Notice and in the body-level a11y-speak
live region), so `screen.getByText` throws "Found multiple elements".

Capture the `container` from `render()` and use
`within( container ).getByText(...)` so queries only see the
rendered Notice and ignore the screen-reader announcement region
that lives outside the container.

Verified locally: all 5 tests in `notice-box.test.jsx` pass.

* Search: bundle @wordpress/theme and @wordpress/private-apis in the dashboard build

The Notice migration introduced a transitive dep on `@wordpress/theme` via
`@wordpress/ui`. The dependency-extraction-webpack-plugin externalized it to
the `wp-theme` script handle, which is not reliably registered as a WP script
in plain admin contexts (e.g., Jurassic Ninja test sites). When `wp-theme` was
missing from `$wp_scripts->registered`, WordPress silently skipped printing
`jp-search-dashboard` -- no script tag, no inline initial state, blank page.

Bundle both `@wordpress/theme` and `@wordpress/private-apis` together so the
module-init `lock()` call lands on the same private-apis consent map. Same
fix as #48173 (Components Notice migration) and #48171 (Boost). The search
dashboard does not pull in `@wordpress/dataviews`, so this does not hit the
my-jetpack collision case described there.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Search: fix changelogger Type for jetpack plugin entry

The jetpack plugin's changelogger uses bugfix/enhancement/compat/major/other
taxonomy, not fixed/changed/added/removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Boost A feature to speed up the site and improve performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants