Traffic Settings: Import ToggleControl from @wordpress/components#48189
Traffic Settings: Import ToggleControl from @wordpress/components#48189
Conversation
Migrate the `ToggleControl` usages on the Jetpack Traffic settings page (Site Stats, Related Posts, Google Analytics, Blaze, SEO) off the `@automattic/jetpack-components` wrapper and onto `@wordpress/components` directly. - Add `__nextHasNoMarginBottom` on every call site so margin matches what the wrapper was setting by default and no deprecation warning fires. - Drop the wrapper's `toggling` prop (not present on the upstream component). Existing `disabled` guards keep repeat submissions from firing while settings are in flight; the only user-visible loss is the short optimistic-flip / dim effect during the save round-trip. The `@automattic/jetpack-components` wrapper and its other consumers (including the ModuleToggle wrapper used elsewhere on the same page) are intentionally left alone — separate follow-up. Part of #48160.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryThis 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. 🤷 |
Fixes #48160 (partial — one box on the tracking issue).
Proposed changes
ToggleControlusages on the Jetpack Traffic settings page (Site Stats, Related Posts, Google Analytics, Blaze, SEO) off the@automattic/jetpack-componentswrapper and onto@wordpress/componentsdirectly.__nextHasNoMarginBottom={ true }on every call site so margin matches what the wrapper was setting by default and no deprecation warning fires.togglingprop (not present on the upstream component). Existingdisabledguards keep repeat submissions from firing while settings are in flight; the only user-visible loss is the short optimistic-flip / dim effect during the save round-trip.The
@automattic/jetpack-componentswrapper and its other consumers (including theModuleTogglewrapper used elsewhere on the same page) are intentionally left alone — separate follow-up.Same shape as #48179 (Security Settings).
The 5 files touched have 12 direct
ToggleControlcall sites in total:blaze.jsx(2 — disabled fallback toggles)google-analytics.jsx(2)related-posts.jsx(2)seo.jsx(1 — AI SEO enhancer)site-stats.jsx(5)Related product discussion/links
Does this pull request change what data or activity we track or use?
No. This is a UI-layer refactor: only the import source of
ToggleControland its rendered__nextHasNoMarginBottom/togglingprops change. No telemetry, option storage, REST surface, or user data flow is modified.Screenshots
The two PNGs are byte-for-byte identical (CRC32
0x868c8034for both, captured viahtml2canvasagainst the same DOM after the trunk-equivalent and post-migration rsyncs respectively). That confirms the migration produces zero rendered-pixel change at rest — expected, because the wrapper was already passing__nextHasNoMarginBottom={ true }through to the upstream component, and the only visible difference (togglingdim) only appears during an in-flight save.JN rsync target:
plugins/jetpack· Baseline:trunk· JN site:https://thoughtfully-remarkable-device.jurassic.ninjaTesting instructions
On a connected Jetpack site, visit Jetpack → Settings → Traffic.
Toggle each of the following and confirm they save and persist (no console errors):
Highlight related content with a heading,Show a thumbnail image where availableAutomatically generate SEO title…Include a small chart in your admin bar…,Count logged in page views fromrows,Allow Jetpack Stats to be viewed byrows,Show post views for this site.Verify the deprecation warning about
__nextHasNoMarginBottomno longer fires for these toggles.Confirm the
ModuleToggle-driven toggles (e.g.Show related content after posts,Customize your SEO settings,Add canonical URLs to archive pages, the Blaze module switch) and their in-flight dim effect still work as before — they're untouched by this PR.Changelog entry added
Visual diff reviewed (both PNGs are byte-identical)