Skip to content

Commit

Permalink
Add missing derived state in the server
Browse files Browse the repository at this point in the history
  • Loading branch information
luisherranz committed Nov 28, 2024
1 parent efb61b5 commit 45bc81f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/block-library/src/playlist/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ function render_block_core_playlist( $attributes, $content ) {
wp_interactivity_state(
'core/playlist',
array(
'currentTrack' => function () {
'currentTrack' => function () {
$state = wp_interactivity_state();
$context = wp_interactivity_get_context();
return $state['tracks'][ $context['currentId'] ];
},
'isCurrentTrack' => function () {
$context = wp_interactivity_get_context();
return $context['currentId'] === $context['id'];
},
)
);

Expand Down

0 comments on commit 45bc81f

Please sign in to comment.