Commit 641cf5a127 for wordpress.org
commit 641cf5a12752998a0a4db580054e93c2b646595b
Author: Weston Ruter <weston@xwp.co>
Date: Mon Dec 22 20:20:33 2025 +0000
Script Loader: Fix script module `fetchpriority` calculation when dependent with higher priority is not enqueued.
Developed in https://github.com/WordPress/wordpress-develop/pull/10651
Follow-up to [60931], [60704].
Props westonruter, jonsurrell, youknowriad.
See #61734.
Fixes #64429.
Built from https://develop.svn.wordpress.org/trunk@61401
git-svn-id: http://core.svn.wordpress.org/trunk@60713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/class-wp-script-modules.php b/wp-includes/class-wp-script-modules.php
index ff39739995..6889b5f09a 100644
--- a/wp-includes/class-wp-script-modules.php
+++ b/wp-includes/class-wp-script-modules.php
@@ -461,9 +461,9 @@ class WP_Script_Modules {
'id' => $id . '-js-module',
);
- $script_module = $this->registered[ $id ];
- $dependents = $this->get_recursive_dependents( $id );
- $fetchpriority = $this->get_highest_fetchpriority( array_merge( array( $id ), $dependents ) );
+ $script_module = $this->registered[ $id ];
+ $queued_dependents = array_intersect( $this->queue, $this->get_recursive_dependents( $id ) );
+ $fetchpriority = $this->get_highest_fetchpriority( array_merge( array( $id ), $queued_dependents ) );
if ( 'auto' !== $fetchpriority ) {
$attributes['fetchpriority'] = $fetchpriority;
}
diff --git a/wp-includes/class-wp-scripts.php b/wp-includes/class-wp-scripts.php
index 03829a20bd..7628db0a87 100644
--- a/wp-includes/class-wp-scripts.php
+++ b/wp-includes/class-wp-scripts.php
@@ -1092,7 +1092,7 @@ JS;
*
* @since 6.9.0
* @see self::filter_eligible_strategies()
- * @see WP_Script_Modules::get_highest_fetchpriority_with_dependents()
+ * @see WP_Script_Modules::get_highest_fetchpriority()
*
* @param string $handle Script module ID.
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 333dadc3ae..d53c560d54 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61400';
+$wp_version = '7.0-alpha-61401';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.