Commit 31d6f71161 for wordpress.org

commit 31d6f711617727aac5152debfc6567bf1c404d6d
Author: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Date:   Sat Oct 17 16:46:50 2026 +0000

    Connectors: Preload the screen's REST API responses.

    The Connectors screen requested the site settings, the `OPTIONS` response of the plugins endpoint, and the records of the AI plugin and of each connector's plugin only after its scripts loaded, which delayed its first render.
    Adds the private `_wp_connectors_preload_paths()` callback to the `wp_options_connectors_wp_admin_preload_paths` filter, so these responses are embedded in the page. Only successful responses are preloaded, so the screen still requests the records of plugins that aren't installed.
    The filter is applied by the page that the Gutenberg build generates, so the preloading takes effect once the pinned Gutenberg version includes https://github.com/WordPress/gutenberg/pull/77353.

    Developed in https://github.com/WordPress/wordpress-develop/pull/11790 and https://github.com/WordPress/gutenberg/pull/77353.

    Props westonruter, wildworks, jorgefilipecosta, mukesh27, apermo, ugyensupport, gziolo, justlevine, peterwilsoncc, ellatrix, cbravobernal.
    Fixes #65215.
    Built from https://develop.svn.wordpress.org/trunk@64438


    git-svn-id: http://core.svn.wordpress.org/trunk@63588 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-admin/options-connectors.php b/wp-admin/options-connectors.php
index ddad78f4f1..eacb9bdb5f 100644
--- a/wp-admin/options-connectors.php
+++ b/wp-admin/options-connectors.php
@@ -32,6 +32,48 @@ $title = __( 'Connectors' );
 // Set parent file for menu highlighting.
 $parent_file = 'options-general.php';

+/**
+ * Preloads the REST API responses the Connectors UI fetches on mount.
+ *
+ * Without this, the page does a network round-trip for site settings,
+ * plugin capability discovery, and each connector's plugin record after
+ * the JS hydrates, which noticeably delays first paint.
+ *
+ * @since 7.2.0
+ * @access private
+ *
+ * @param array<string|string[]> $preload_paths Paths already queued for preloading.
+ * @return array<string|string[]> Paths with the Connectors-specific requests appended.
+ *
+ * @phpstan-param array<non-falsy-string|array{ non-falsy-string, 'GET'|'OPTIONS' }> $preload_paths
+ * @phpstan-return array<non-falsy-string|array{ non-falsy-string, 'GET'|'OPTIONS' }>
+ */
+function _wp_connectors_preload_paths( array $preload_paths ): array {
+	// getEntityRecord( 'root', 'site' ) in use-connector-plugin.ts / ai-plugin-callout.tsx.
+	$preload_paths[] = '/wp/v2/settings';
+
+	// canUser( 'create', { kind: 'root', name: 'plugin' } ) in stage.tsx.
+	$preload_paths[] = array( '/wp/v2/plugins', 'OPTIONS' );
+
+	// AiPluginCallout in routes/connectors-home/ai-plugin-callout.tsx queries this
+	// hardcoded ID to check whether the WP AI plugin is installed/active.
+	$preload_paths[] = '/wp/v2/plugins/ai/ai?context=edit';
+
+	// getEntityRecord( 'root', 'plugin', <basename> ) per connector in use-connector-plugin.ts.
+	foreach ( wp_get_connectors() as $connector_data ) {
+		if ( empty( $connector_data['plugin']['file'] ) ) {
+			continue;
+		}
+		// core-data's plugin entity uses the basename with `.php` stripped
+		// as the record key (see routes/connectors-home/use-connector-plugin.ts).
+		$basename        = preg_replace( '/\.php$/', '', plugin_basename( $connector_data['plugin']['file'] ) );
+		$preload_paths[] = '/wp/v2/plugins/' . $basename . '?context=edit';
+	}
+
+	return $preload_paths;
+}
+add_filter( 'wp_options_connectors_wp_admin_preload_paths', '_wp_connectors_preload_paths' );
+
 require_once ABSPATH . 'wp-admin/admin-header.php';

 // Render the Connectors page.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index f12029b49e..8805e6d52e 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64437';
+$wp_version = '7.2-alpha-64438';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.