From 1144a460c8409e5b784bad68dded3cfe1b2b66d8 Mon Sep 17 00:00:00 2001 From: luisherranz Date: Tue, 17 Feb 2026 08:46:42 +0000 Subject: [PATCH] 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 --- .../interactivity-api/class-wp-interactivity-api.php | 8 ++++++++ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/wp-includes/interactivity-api/class-wp-interactivity-api.php b/wp-includes/interactivity-api/class-wp-interactivity-api.php index 106055f6ff..b4cc86566d 100644 --- a/wp-includes/interactivity-api/class-wp-interactivity-api.php +++ b/wp-includes/interactivity-api/class-wp-interactivity-api.php @@ -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() ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 843831db61..4dd5c55e30 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.