[wp-trac] [WordPress Trac] #65103: Single-page admin screens (Connectors, Font Library) fail to mount in Chrome when @wordpress/boot wins a race against its classic-script deps
WordPress Trac
noreply at wordpress.org
Sun May 10 16:07:05 UTC 2026
#65103: Single-page admin screens (Connectors, Font Library) fail to mount in
Chrome when @wordpress/boot wins a race against its classic-script deps
-------------------------------------------------+-------------------------
Reporter: fabiankaegy | Owner: (none)
Type: defect (bug) | Status: new
Priority: high | Milestone: 7.0
Component: Script Loader | Version: trunk
Severity: normal | Resolution:
Keywords: script-modules has-patch changes- | Focuses:
requested | administration
-------------------------------------------------+-------------------------
Comment (by westonruter):
@khokansardar These changes need to be made in the Gutenberg repo, as far
as I know.
This is the template code needing to be modified:
https://github.com/WordPress/gutenberg/blob/5fc7223e96b2751c57b6c4ae840bb9e838bee9f0/packages
/wp-build/templates/page-wp-admin.php.template#L156-L164
Note that you can also now indent the PHP nowdoc strings with the
[https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes flexible
syntax] thanks to WordPress increasing the minimum PHP version to 7.4.
So you can indent consistently like this, adding indents to your patch:
{{{#!php
<?php
/*
* Add inline script to initialize the app using
initSinglePage (no menuItems).
* The dynamic import is deferred until DOMContentLoaded
so that all classic
* script dependencies of @wordpress/boot (wp-private-
apis, wp-components,
* wp-theme, etc.) have finished parsing and executing
before the boot module
* evaluates. Otherwise, a modulepreloaded @wordpress/boot
can win the race
* against the classic-script-printing pass on fast CDN-
fronted hosts in
* Chrome, evaluating before wp.theme.privateApis is
defined and throwing
* "Cannot unlock an undefined object". See #65103.
*/
$init_js_function = <<<'JS'
( mountId, routes ) => {
const run = async () => {
const mod = await import(
"@wordpress/boot" );
mod.initSinglePage( { mountId, routes } );
};
if ( document.readyState === "loading" ) {
document.addEventListener(
"DOMContentLoaded", run );
} else {
run();
}
}
JS;
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65103#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list