Skip to content

Commit e324535

Browse files
authored
Use wp_interactivity_config() for static values (#2096)
1 parent 018abb9 commit e324535

File tree

21 files changed

+68
-58
lines changed

21 files changed

+68
-58
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: changed
3+
4+
Use wp_interactivity_config() for static values instead of wp_interactivity_state() to improve performance and code clarity

build/follow-me/render.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
$background_color = $attributes['backgroundColor'] ?? $style['color']['background'] ?? '';
4040
$button_style = $attributes['style'] ?? array();
4141

42-
// Set up the Interactivity API state.
43-
wp_interactivity_state(
42+
// Set up the Interactivity API config.
43+
wp_interactivity_config(
4444
'activitypub/follow-me',
4545
array(
4646
'namespace' => ACTIVITYPUB_REST_NAMESPACE,

build/follow-me/view.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '1bdc53d1581dc837c6e5', 'type' => 'module');
1+
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '74866c35caac5982b6c6', 'type' => 'module');

build/follow-me/view.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/followers/render.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ function ( $follower ) {
6969
$follower_data['followers']
7070
);
7171

72-
// Set up the Interactivity API state.
73-
wp_interactivity_state(
72+
// Set up the Interactivity API config.
73+
wp_interactivity_config(
7474
'activitypub/followers',
7575
array(
7676
'defaultAvatarUrl' => ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg',

build/followers/view.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '1ee127d6b44f5125a728', 'type' => 'module');
1+
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '5411018a8072e4c95c87', 'type' => 'module');

build/followers/view.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/reactions/render.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,18 @@ function ( $comment ) {
8787
return;
8888
}
8989

90-
// Set up the Interactivity API state.
91-
wp_interactivity_state(
90+
// Set up the Interactivity API config.
91+
wp_interactivity_config(
9292
'activitypub/reactions',
9393
array(
9494
'defaultAvatarUrl' => ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg',
9595
'namespace' => ACTIVITYPUB_REST_NAMESPACE,
96-
'reactions' => array(
97-
$_post_id => $reactions,
98-
),
9996
)
10097
);
10198

99+
// Set up the Interactivity API state.
100+
wp_interactivity_state( 'activitypub/reactions', array( 'reactions' => array( $_post_id => $reactions ) ) );
101+
102102
// Render a subset of the most recent reactions.
103103
$reactions = array_map(
104104
function ( $reaction ) use ( $attributes ) {

build/reactions/view.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '4067078b710ef29f00a0', 'type' => 'module');
1+
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '1fb302a91b9b62d50174', 'type' => 'module');

0 commit comments

Comments
 (0)