Skip to content

My Jetpack: Fix the onboarding wizard crashing on WordPress 7.0 - #53880

Closed
DevinWalker wants to merge 1 commit into
trunkfrom
fix/my-jetpack-onboarding-wizard-wp-70-theme
Closed

DevinWalker wants to merge 1 commit into
trunkfrom
fix/my-jetpack-onboarding-wizard-wp-70-theme

Conversation

@DevinWalker

Copy link
Copy Markdown
Contributor

Fixes #

Proposed changes

  • My Jetpack's webpack build now bundles @wordpress/theme (and @wordpress/private-apis) via bundleWpUiDeps: true. Boost, Protect and the Jetpack plugin already use this option for entries that bundle @wordpress/ui.
  • Why: the onboarding wizard imports ThemeProvider from @wordpress/theme. With the default config, that import is externalized to core's wp-theme script. On WordPress 7.0, wp-includes/js/dist/theme.js exports only privateApis, with ThemeProvider locked inside it. 7.1 added the public export. So on 7.0, ThemeProvider is undefined, and the wizard throws "Element type is invalid … got: undefined" on its first render (React error fix certain issues with widget visibility conditions and static pages #130 in production). The page stays blank. WordPress 7.0 is the minimum version Jetpack, Protect and Boost support.
  • The webpack-config README warns against this option for entries that unlock private APIs from an external wp-* script. None of My Jetpack's three webpack entries do:
    • My Jetpack's source has no unlock() or privateApis use.
    • The trunk build of onboarding, header-controls and async-notification-bubble contains no privateApis reference at all.
    • @wordpress/ui's own privateApis fallback is tree-shaken out of these entries.
    • The routes app is built by wp-build, which this option doesn't touch.
  • Build output (production):
    • onboarding.asset.php no longer depends on wp-theme. It now depends on wp-compose, which the bundled theme uses.
    • header-controls and async-notification-bubble keep the same dependencies. Only their module IDs change.
    • onboarding.js goes from 262,199 B to 338,865 B (62,143 B to 88,901 B gzipped). The extra code is @wordpress/theme and colorjs.io, which ThemeProvider uses to build its color ramps at runtime. Core's wp-theme carries the same code, but 7.0 offers it only as a private API. Once My Jetpack: load the onboarding wizard in its own chunk #53750 lazy-loads the wizard, this cost moves into the wizard's chunk, so it's only downloaded when the flag is on.
  • The wizard is behind the my-jetpack-onboarding-wizard feature flag, so nothing changes for site owners yet. The changelog entry is only on packages/my-jetpack.

Related product discussion/links

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

No.

Testing instructions

You need a site running WordPress 7.0. 7.1 exports ThemeProvider publicly, so the bug doesn't show there. Gutenberg replaces wp-theme too, so leave it inactive.

  • A fresh monorepo Docker env downloads the latest WordPress (7.1.3 today). On any newer site, run wp core download --version=7.0 --force to get 7.0.
  • In the monorepo Docker env, Jetpack treats localhost and 127.0.0.1 as offline mode, and My Jetpack doesn't load in offline mode. Use a JN site, or add add_filter( 'jetpack_is_local_site', '__return_false' ); to an mu-plugin.
  1. Activate a plugin that bundles My Jetpack (Jetpack or Protect) on a site that has never been registered.
  2. Turn the wizard flag on, for example with an mu-plugin:
    add_filter( 'jetpack_feature_flag_enabled_my-jetpack-onboarding-wizard', '__return_true' );
  3. Before (trunk): open Jetpack → My Jetpack. You're redirected to page=my-jetpack&step=onboarding, and the page is blank. The console shows "Element type is invalid … got: undefined", and Object.keys( wp.theme ) is [ 'privateApis' ].
  4. After (this branch): build My Jetpack and reload. The wizard's start step renders ("Set up Jetpack · Step 1 of 4", the dark rail and "Start with Jetpack for free"), and the console has no errors.
  5. Check projects/packages/my-jetpack/build/onboarding.asset.php: wp-theme is no longer in the dependency list.
  6. Turn the flag off and reload. The single "Start with Jetpack for free" connect screen renders as before.

…on WordPress 7.0

The wizard imports ThemeProvider from @wordpress/theme, which was
externalized to core's wp-theme script. WordPress 7.0's wp-theme exports
only privateApis, so ThemeProvider was undefined and the wizard threw on
render. bundleWpUiDeps bundles @wordpress/theme and @wordpress/private-apis,
as Boost, Protect and the Jetpack plugin already do. None of My Jetpack's
webpack entries unlock private APIs from an external wp-* script.
@DevinWalker DevinWalker added Bug When a feature is broken and / or not performing as intended [Status] Needs Review This PR is ready for review. labels Oct 20, 2026
@DevinWalker DevinWalker self-assigned this Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 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), and enable the fix/my-jetpack-onboarding-wizard-wp-70-theme branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/my-jetpack-onboarding-wizard-wp-70-theme

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

@github-actions

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!

@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@DevinWalker

Copy link
Copy Markdown
Contributor Author

Folding this into #52775 so the wizard and its WordPress 7.0 fix land together. Closing this one.

@github-actions github-actions Bot removed the [Status] Needs Review This PR is ready for review. label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Package] My Jetpack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant