Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: added
Comment: PHPDoc comment change.


Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public static function configure() {

/**
* Register assets.
*
* NOTICE: Please think twice before including Connection scripts in the frontend.
* Those scripts are intended to be used in WP admin area.
*/
public static function register_assets() {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Blocks: initialize connection assets in Story block.
6 changes: 6 additions & 0 deletions projects/plugins/jetpack/extensions/blocks/story/story.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Automattic\Jetpack\Extensions\Story;

use Automattic\Jetpack\Blocks;
use Automattic\Jetpack\Connection\Connection_Assets;
use Jetpack;
use Jetpack_Gutenberg;
use Jetpack_PostImages;
Expand Down Expand Up @@ -442,6 +443,11 @@ function render_block( $attributes ) {
// Let's use a counter to have a different id for each story rendered in the same context.
static $story_block_counter = 0;

if ( 0 === $story_block_counter ) {
// @todo Fix the webpack tree shaking so the block's view.js no longer depends on jetpack-connection, then remove this.
Connection_Assets::register_assets();
Comment thread
sergeymitr marked this conversation as resolved.
Resolved
}

Jetpack_Gutenberg::load_assets_as_required( __DIR__ );

$media_files = isset( $attributes['mediaFiles'] ) ? enrich_media_files( $attributes['mediaFiles'] ) : array();
Expand Down