From 399c71164bf18f209c74dad6ad381f87c8514494 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Thu, 19 Jan 2023 09:43:01 +0100 Subject: [PATCH] Blaze: always enqueue Connection state info We previously relied on the plugins that were enabling Blaze (i.e. Jetpack for now) to enqueue that info for us: https://github.com/Automattic/jetpack/blob/e16722f28354c610c59e7a83ddb21c16d58d43a7/projects/plugins/jetpack/class.jetpack-gutenberg.php#L737-L738 However, in some scenarios, it would seem that this is not enqueued while the Blaze editor is. I'm not quite sure how exactly this happens yet, but I think we can alleviate such problems by ensuring we enqueue the Connection info every time we enqueue the Blaze editor. --- .../blaze/changelog/fix-blaze-missing-connection-info | 4 ++++ projects/packages/blaze/src/class-blaze.php | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 projects/packages/blaze/changelog/fix-blaze-missing-connection-info diff --git a/projects/packages/blaze/changelog/fix-blaze-missing-connection-info b/projects/packages/blaze/changelog/fix-blaze-missing-connection-info new file mode 100644 index 000000000000..53e495a27cec --- /dev/null +++ b/projects/packages/blaze/changelog/fix-blaze-missing-connection-info @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Always enqueue Jetpack Connnection info when enqueuing Blaze script diff --git a/projects/packages/blaze/src/class-blaze.php b/projects/packages/blaze/src/class-blaze.php index 35fee14b85f8..65be6fc0b35b 100644 --- a/projects/packages/blaze/src/class-blaze.php +++ b/projects/packages/blaze/src/class-blaze.php @@ -7,6 +7,7 @@ namespace Automattic\Jetpack; +use Automattic\Jetpack\Connection\Initial_State as Connection_Initial_State; use Automattic\Jetpack\Connection\Manager as Jetpack_Connection; use Automattic\Jetpack\Status\Host; use Automattic\Jetpack\Sync\Settings as Sync_Settings; @@ -190,5 +191,8 @@ public function enqueue_block_editor_assets( $hook ) { 'textdomain' => 'jetpack-blaze', ) ); + + // Adds Connection package initial state. + wp_add_inline_script( 'jetpack-promote-editor', Connection_Initial_State::render(), 'before' ); } }