Image Studio: Enqueue assets on next_admin_init#47675
Image Studio: Enqueue assets on next_admin_init#47675
next_admin_init#47675Conversation
|
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: 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. |
Code Coverage SummaryCoverage changed in 1 file.
|
kat3samsin
left a comment
There was a problem hiding this comment.
Works on Atomic and ciab-admin.
d2bf257 to
37f8777
Compare
projects/plugins/jetpack/extensions/plugins/image-studio/image-studio.php
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| // Signal to Big Sky that Jetpack is handling Image Studio, so it skips its own loading. | ||
| add_filter( 'jetpack_image_studio_enabled', '__return_true', 5 ); |
There was a problem hiding this comment.
Claude flagged this
Nit (non-blocking): The Big Sky signal filter is added before get_asset_data() is checked:
add_filter( 'jetpack_image_studio_enabled', '__return_true', 5 );`
$asset_data = get_asset_data();
if ( ! $asset_data ) {
return; // Big Sky already told to skip, but Jetpack won't load either
}
If the asset manifest fetch fails (network error, missing file), Big Sky is signaled to stand down, but Jetpack's Image Studio won't actually enqueue — leaving the user with neither implementation.
I realize signal_image_studio_active() on init already has the same behavior (signals without verifying assets), so this isn't a new issue. But since you're already touching this function, would it be worth moving the add_filter to after the get_asset_data() check succeeds? That way the signal in do_enqueue_assets at least only fires when assets actually load. The init hook signal would still have the pre-existing gap, but this would be a small step toward correctness.
There was a problem hiding this comment.
Hmm I feel it is okay. The intention of setting this filter is to prevent the Big Sky version from loading. Being a legacy version of the Image Studio, I don't think the Big Sky version should act as a fallback. It should probably be removed from the Big Sky plugin once the Jetpack release has completed.
Part of FORNO-250
Proposed changes
next_admin_inithook to support user in CIAB.jetpack_image_studio_availablefilter to enable consumers to disable Image Studio even if the conditions to enable it are met.Other information
Related product discussion/links
Does this pull request change what data or activity we track or use?
No
Testing instructions
Check for regression:
bin/jetpack-downloader test jetpack forno-250/image-studio-ciab-supporton your sandboxCIAB integration:
ciab-adminPR 3814