Skip to content

Load no NeoWiki frontend for readers of pages that show no Subjects - #1917

Open
alistair3149 wants to merge 1 commit into
masterfrom
alistair3149/no-frontend-without-neowiki-ui
Open

alistair3149 wants to merge 1 commit into
masterfrom
alistair3149/no-frontend-without-neowiki-ui

Conversation

@alistair3149

@alistair3149 alistair3149 commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Every content page loaded NeoWiki's whole frontend, which does nothing for a reader of a page that shows no Subjects. A content page now loads it only where it shows a View, its Main Subject in full or a {{#create_subject}} button, or where the viewer may edit the page and so gets the Subject creator. A reader of any other page skips 204 KB of JavaScript; on a throttled mobile profile, a plain article's load drops from 2.8 s to 1.4 s. Other pages are unchanged.

Human input

Goal and shape: @alistair3149 asked for a spike on the frontend bundle's size, saying NeoWiki should not load frontend code a page does not need, and picked this change from its findings to do as its own PR. The proposal they picked was "load nothing on pages with no Views or Subjects for viewers who can't create one"; the design within it is Claude's.

Outcome: not reviewed by a human yet; @alistair3149 asked for the history to be squashed before pushing. Left for you: which pages still load the frontend, and the line in extending.md that tells extension authors.

Claude's calls

  • Not discussed with @alistair3149:
    • "May edit the page" is the right that creating a Subject on it needs, so the viewers who keep the frontend are exactly those who can create one. On a wiki that lets anyone edit, that is every reader, and nothing changes there.
    • Whether a page shows a View is read from its HTML, for the placeholder's class wherever it sits in the tag, so pages already in the parser cache need no reparse and markup Parsoid rewrites still counts.
    • A page that holds Subjects but shows none, with automatic rendering off and no {{#view}}, loads none of NeoWiki's frontend for a reader.
    • Modules that extensions add through NeoWikiGetFrontendModules follow the frontend: a reader of a page that shows no Subjects no longer loads them.
  • Considered by Claude, omitted:
    • A flag that {{#view}} and the other placeholder writers set at parse time: pages cached before the upgrade would lack it, and their Views would stay blank for readers until reparsed.
    • A small launcher module that gives editors the page tools and loads the rest on click: it belongs with splitting the bundle into view and editor modules.
    • Views outside the page body, such as one in MediaWiki:Sitenotice, which the page HTML does not hold: no such use is known.
  • Where your judgment helps: an extension whose module counted on every content page for readers now misses the pages that show no Subjects.

The change

  • NeoWikiHooks::needsFrontend() decides, with ViewHtmlBuilder::containsView(), new, and containsMainSubjectInFull(), and the {{#create_subject}} check onBeforePageDisplay() already made.
  • docs/extending/extending.md says where NeoWikiGetFrontendModules modules load on a content page.

Release notes

  • Readers of pages that show no Subjects no longer download NeoWiki's JavaScript
Verification evidence
  • make ci: PHPUnit 5225 tests, 10 skipped; phpcs and phpstan without errors. Seen failing first: the reader test and the containsView() tests against master, the {{#create_subject}} test and the rewritten-markup case against earlier states of this branch; the test for a reader of a page whose Main Subject NeoWiki shows fails against a mutant that decides before placing it.
  • make tsci equivalents: vitest 216 files, 4006 tests; build and lint green. No TypeScript changes.
  • Browser tests: 13 passed. A Playwright check on the final code: a reader of a plain article loads neither ext.neowiki nor RedHerb's modules; a reader of Claude Monet gets the infobox; an editor of the plain article gets the frontend, and "Create subject" opens the creator; a reader of a page carrying {{#create_subject}} gets the frontend config and the button opens its dialog; no page errors.
  • Timing in the dev stack, 4× CPU slowdown, 1.6 Mbps, 150 ms latency, medians of 5 cold loads by a reader who may not edit:
    • plain article, with RedHerb's test modules loading too: JavaScript 470 → 200 KB, load 3.04 → 1.37 s, script time per page load 216 → 101 ms. Without RedHerb, master's load was 2.84 s.
    • a talk page, which NeoWiki does not touch: 1.38 s, so the plain article now loads like a page without NeoWiki.
    • Claude Monet, which shows an infobox: unchanged.
  • AI review, in the authoring session: review-tests (every in-scope class measured; it found the {{#create_subject}} case, which a fresh text review of the docs line had flagged too), /code-review (high) and /simplify (four angles). Applied: the button case, a View check that tolerates markup a parser rewrote and checks the cheaper mount first, tests for both and for the editor's app container and a reader's RDF links. Considered and left: the parse-time flag and Views outside the page body, above.

AI-authored — Claude Code, claude-opus-5-5, on a Professional Wiki account; @alistair3149 asked for the bundle-size spike and picked this change from its findings; not reviewed by a human

Every content page loaded NeoWiki's whole frontend, which does nothing
for a reader of a page that shows no Subjects. A content page now loads
it only where it shows a View, its Main Subject in full or a
{{#create_subject}} button, or where the viewer may edit the page and
so gets the Subject creator. A reader of any other page skips 204 KB of
JavaScript; on a throttled mobile profile, a plain article's load drops
from 2.8 s to 1.4 s. Other pages are unchanged.

- NeoWikiHooks::needsFrontend() decides, with
  ViewHtmlBuilder::containsView(), new, and containsMainSubjectInFull(),
  and the {{#create_subject}} check onBeforePageDisplay() already made.
- docs/extending/extending.md says where NeoWikiGetFrontendModules
  modules load on a content page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alistair3149
alistair3149 force-pushed the alistair3149/no-frontend-without-neowiki-ui branch from f2cbf44 to 0e61070 Compare November 21, 2026 00:41
@alistair3149
alistair3149 marked this pull request as ready for review November 21, 2026 00:42
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