Skip to content

Route component modules to the matching ResourceLoader queue - #126

Draft
malberts wants to merge 2 commits into
masterfrom
fix/route-modules-to-matching-queue
Draft

Route component modules to the matching ResourceLoader queue#126
malberts wants to merge 2 commits into
masterfrom
fix/route-modules-to-matching-queue

Conversation

@malberts

@malberts malberts commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

onParserAfterParse added every active component's modules to both queues. ResourceLoader accepts only
styles-only modules in the styles queue, so modal.fix, carousel.fix, tooltip.fix and popover.fix each
logged Unexpected general module "..." in styles queue. on every page view that activated their component.
The first three also lost their stylesheet from the render-blocking <head> output; popover.fix carries no
stylesheet, so for it only the log line was affected.

Route each module to the queue matching its type. Styles-only modules keep their render-blocking <link>;
modules carrying scripts or dependencies go to the general queue, which delivers their styles too.

Dropping the addModuleStyles() call instead also silences the error, but it demotes the styles-only modules
to JS-delivered CSS, trading log noise for a flash of unstyled content on elements visible at first paint.

Splitting the four combined modules into separate styles and script modules is what would restore
render-blocking CSS for them. That is not done here and is not currently tracked: #90 covers the per-skin
resolution mechanism and #118 the stylesheet contents, so neither carries it. The hardcoded 'vector'
argument and the unused $skin on the adjacent lines do belong to #90.

No remaining call site can put a general module into the styles queue, so the logged error is gone for
good: the only other additions there are ext.bootstrap.styles and ext.bootstrapComponents.bootstrap.fix,
both styles-only.

The inverse case is untouched. Hooks/OutputPageParserOutput queues ext.bootstrapComponents.vector-fix with
addModules(), and that module is declared for no component, so no path ever puts it in the styles queue. Its
rules are page-wide (html { font-size }, body.skin-vector *, *::before, *::after { box-sizing: initial }),
so on Vector they take effect only once the module has loaded. AbstractComponent::augmentParserOutput() also
adds a rendered component's modules with addModules() regardless of type, through a ParserOutputHelper
bound to whichever parser reached ParserFirstCallInit first; those additions are not visible in the queues of
a rendered page.

AI-authored — Claude Code, Opus 5 (1M context); started from a production log excerpt supplied by
@malberts, approach narrowed once after a challenge on minimality, then revised after a four-lens AI review;
diff not yet human-reviewed; unit suite run locally against MW 1.43, and the log line reproduced and then
confirmed gone on a real page render.

malberts and others added 2 commits July 30, 2026 12:18
`onParserAfterParse` added every active component's modules to both queues. ResourceLoader accepts only
styles-only modules in the styles queue, so `modal.fix`, `carousel.fix`, `tooltip.fix` and `popover.fix` each
logged `Unexpected general module "..." in styles queue.` on every page view that activated their component,
and had their stylesheet dropped from the render-blocking `<head>` output.

Route each module to the queue matching its type. Styles-only modules keep their render-blocking `<link>`;
modules carrying scripts or dependencies go to the general queue, which delivers their styles too.

Simply dropping the `addModuleStyles()` call also silences the error, but it demotes the styles-only modules to
JS-delivered CSS, trading log noise for a flash of unstyled content on elements visible at first paint.

Splitting the combined modules into separate styles and script modules would additionally restore
render-blocking CSS for the four affected components. Deferred: #90 is set to redesign this loading mechanism
and #118 flags dead Bootstrap 3 selectors in several of these stylesheets, so the split is better made once
that audit has settled. The hardcoded `'vector'` argument and the unused `$skin` on the adjacent lines are
likewise left to #90.

The tests assert the queue-type invariant in both directions rather than naming individual modules, so a later
module split leaves them passing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The two queue-type invariants asserted absence only, so they stayed green when the
styles-only modules were dropped altogether. Assert the expected contents of each
queue instead, which pins delivery as well as routing.

The invariant form also claimed more than holds: `AbstractComponent::augmentParserOutput`
puts every module of a rendered component into the general queue regardless of type, so
"no styles-only module in the general queue" is true of this hook alone, not of a real
render.

Name the module parameter for what it holds, compare against null explicitly, and widen
the note to the other options that make a module non-styles-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant