Skip to content

Route component modules to the matching ResourceLoader queue - #126

Merged
malberts merged 1 commit into
masterfrom
fix/route-modules-to-matching-queue
Oct 8, 2026
Merged

malberts merged 1 commit into
masterfrom
fix/route-modules-to-matching-queue

Conversation

@malberts

@malberts malberts commented Jul 30, 2026 •

Copy link
Copy Markdown
Collaborator

Follows-up to #80

Since #80, onParserAfterParse added every module of an active component to both queues. ResourceLoader accepts only styles-only modules in the styles queue, so the modules that also carry scripts (modal.fix, carousel.fix, tooltip.fix, popover.fix) logged Unexpected general module "..." in styles queue. on every page view using them.

Add each module to the queue matching its ResourceLoader type instead. The browser receives the same as before: ResourceLoader skipped those modules in the styles queue, and they loaded through the general queue, where the hook also added them.

Dropping the addModuleStyles() call would also silence the error, but the styles-only modules' CSS would then load through JavaScript: after first paint, and not at all without JavaScript.

Considered, omitted:

  • api.php?action=parse no longer lists those four modules under modulestyles. Core's only consumer, live preview, loads modules and modulestyles together, so nothing in core changes.
  • Pages already in the parser cache keep logging until they are re-parsed.
  • Hooks/OutputPageParserOutput still queues the styles-only ext.bootstrapComponents.vector-fix through the general queue; that is a separate change.
  • The new tests are brittle: they take module types from extension.json through the global ResourceLoader, so they fail if button.fix stops being styles-only or modal.fix loses its scripts. Decoupling them needs the code to receive its ResourceLoader instead of fetching the global one, a production refactor out of scope for this log fix.

AI-authored — Claude Code, Opus 5.5; started from a production log excerpt supplied by @malberts, steered about five times (approach, verification, tests, scope); diff discussed in session with @malberts, no GitHub review yet; unit tests mutation-checked and run locally against MW 1.43, error reproduced and gone and page <head> output compared before and after on a local render.

Production notes

The MW master CI leg fails four ImageModal thumbnail tests because MediaWiki master now adds loading="lazy" to thumbnails; origin/master fails that leg the same way. Earlier revisions of this PR were drafted with Opus 5 (1M context).

Follows-up to #80

Since #80, `onParserAfterParse` added every module of an active component
to both queues. ResourceLoader accepts only styles-only modules in the
styles queue, so the modules that also carry scripts (`modal.fix`,
`carousel.fix`, `tooltip.fix`, `popover.fix`) logged `Unexpected general
module "..." in styles queue.` on every page view using them.

Add each module to the queue matching its ResourceLoader type instead. The
browser receives the same as before: ResourceLoader skipped those modules
in the styles queue, and they loaded through the general queue, where the
hook also added them.

Dropping the `addModuleStyles()` call would also silence the error, but the
styles-only modules' CSS would then load through JavaScript: after first
paint, and not at all without JavaScript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@malberts
malberts force-pushed the fix/route-modules-to-matching-queue branch from 40c2077 to 34047b3 Compare October 8, 2026 14:16
@malberts
malberts marked this pull request as ready for review October 8, 2026 14:25
@malberts
malberts merged commit 5820bda into master Oct 8, 2026
4 of 6 checks passed
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