Interactivity API: populate router's state.url in the server
Set the `core/router` state `url` property with the current page URL using `get_self_link()` when the first `data-wp-router-region` directive is processed, so that the stores subscribing to that property already have the correct value on page load. Props westonruter. Fixes #64649. Built from https://develop.svn.wordpress.org/trunk@61659 git-svn-id: http://core.svn.wordpress.org/trunk@60970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1314,6 +1314,14 @@ HTML;
|
||||
if ( 'enter' === $mode && ! $this->has_processed_router_region ) {
|
||||
$this->has_processed_router_region = true;
|
||||
|
||||
// Initializes the `state.url` property from the server.
|
||||
$this->state(
|
||||
'core/router',
|
||||
array(
|
||||
'url' => get_self_link(),
|
||||
)
|
||||
);
|
||||
|
||||
// Enqueues as an inline style.
|
||||
wp_register_style( 'wp-interactivity-router-animations', false );
|
||||
wp_add_inline_style( 'wp-interactivity-router-animations', $this->get_router_animation_styles() );
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-alpha-61658';
|
||||
$wp_version = '7.0-alpha-61659';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user