LearnNewsExamplesServices
Frontmatter
id19698
titleRealWorld2's API classes call a static Base.on/fire that no class provides
stateClosed
labels
bugai
assigneesneo-opus-grace
createdAtOct 13, 2026, 12:50 AM
updatedAtOct 13, 2026, 1:30 AM
githubUrlhttps://github.com/neomjs/neo/issues/19698
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 13, 2026, 1:30 AM

RealWorld2's API classes call a static Base.on/fire that no class provides

neo-opus-grace
neo-opus-grace commented on Oct 13, 2026, 12:50 AM

Context

The middleware's full SSG rebuild (pages 5df4094, neo.mjs 13.2.0) failed on one route and aborted the deploy chain:

Error rendering route /apps/realworld2/index.html: TypeError: Base.on is not a function
    at Favorite.onConstructed (…/neo.mjs/apps/realworld2/api/Base.mjs:60:18)
    at Object.setupClass (…/neo.mjs/src/Neo.mjs:1034:23)
    at …/neo.mjs/apps/realworld2/api/Favorite.mjs:41:20
Static HTML generation completed with 1 failed route(s): /apps/realworld2/index.html

Earlier middleware runs were incremental with no content delta, so the route was never re-rendered. This full rebuild exposed it.

The Problem

apps/realworld2/api/Base.mjs onConstructed() coordinates its API singletons through static events on the class. The first instance reads the token and calls Base.fire('ready', token); every later instance calls Base.on({ready: me.onReady, scope: me}). static observable = true applies Neo.core.Observable to the prototype only, and Observable defines no static on or fire, as src/core/Observable.mjs shows. Every API singleton after the first therefore throws on construction, and the first throws when its token read resolves. The demo cannot boot, in a browser or in SSR.

The Architectural Reality

  • apps/realworld2/api/Base.mjs: initialTokenRequestSent, Base.fire, Base.on.
  • src/Neo.mjs setupClass(): static observable pushes Neo.core.Observable into the instance mixins.

The Fix

One shared static token promise. The first construction creates it from the LocalStorage read, and every instance chains onReady onto it. This drops the static-event handshake and initialTokenRequestSent. Instance-level observability stays as it is.

Acceptance Criteria

  • A unit arm, red before the fix: constructing two API classes calls each onReady exactly once, with the stored token, and nothing throws.
  • The RealWorld2 app boots in a browser.
  • Post-release (13.3 and a pages bump): the middleware renders /apps/realworld2/index.html.

Out of Scope

  • The middleware's policy of aborting the whole deploy on one failed route. That is its owner's decision.

Related

#19652 (v13.3 cut, the release that carries this to pages).

Live latest-open sweep at 2026-10-12T22:49Z, plus gh search issues for "realworld2" and the error text. No equivalent found.

Origin Session ID: 02040656-932a-48c8-8894-6f43d0368663

tobiu referenced in commit 00780bd - "fix(realworld): the API singletons share one stored-token promise instead of a static ready event no class provides (#19698) (#19700)" on Oct 13, 2026, 1:30 AM
tobiu closed this issue on Oct 13, 2026, 1:30 AM