Jetpack AI: load the Scheduled tasks tab only when it is opened - #51969
Jetpack AI: load the Scheduled tasks tab only when it is opened#51969t-wright wants to merge 3 commits into
Conversation
|
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 SummaryCoverage changed in 3 files.
2 files are newly checked for coverage.
|
446044a to
033380f
Compare
The tab sits behind a flag that defaults to off, yet its DataViews and AI client dependencies shipped in every load of the AI page. Lazy-load the tab into its own chunk, with the plugin printing the chunk base URL because auto publicPath breaks under Simple's script concatenation. Import requestJwt through a new ai-client jwt subpath so the block editor script handles it dragged in stay off the page. Cuts jetpack-ai-admin.js from 1,482 KB to 487 KB and drops six script handles.
A failed chunk load used to throw through Suspense and unmount the whole AI page. A small error boundary now keeps the rest of the page up and asks the user to reload. The lazy-load test moves to its own file so it cannot depend on test order, and the public path module gets the same test its siblings have. Also drops 4 block editor script handles, not 6 as the previous commit said.
On CI the lazy import compiled DataViews during the flag test, and the 1s findBy wait ran out on the Suspense spinner. A static import in the test file moves that transform ahead of the tests.
033380f to
1c08f16
Compare
Fixes FORNO-512
Proposed changes
requestJwtthrough a new@automattic/jetpack-ai-client/jwtsubpath, which keeps the block editor script handles off the page.publicPath: 'auto'breaks under Simple's script concatenation.jetpack-ai-admin.js: 1,482 KB → 488 KB. Script handles: 30 → 25.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
jp build plugins/jetpack --production.jetpack-ai-scheduled-tasks.jsisn't requested.add_filter( 'jetpack_feature_flag_enabled_ai-hub-scheduled-tasks', '__return_true' );