Skip to content
  • Cédric Le Ninivin's avatar
    State pattern: cribjs_launcher (last gadget) — migration COMPLETE · 973514b0
    Cédric Le Ninivin authored
    
    
    Route the page mount through onStateChange: renderXXX does routing +
    declareGadget + child.render (the fetch), holds the live child instance
    in props.main_gadget (DOM-bearing, not JSON), then forces the mount via a
    fresh-seq main_content state key. onStateChange's main_content branch does
    getElement + clear + append (editor.js precedent). changeState resolving
    after the mount preserves the original ordering (decreaseLoadingCounter
    still runs after paint).
    
    Error path (displayErrorContent) stays imperative as the documented
    exception: it runs after MAIN_SCOPE is dropped, outside the render
    lifecycle, faithful to upstream rjs_gadget_erp5_js.js (same precedent as
    gadget_interface.js).
    
    New-code assertion: the in-app JSLint row was NOT clean before (4 undefined
    globals — URI, Uint8Array, Blob, FileReader); declared all four; now 0
    errors. Live: deploy verify OK, smoke 22/22, QUnit 113/113, 0 console
    errors. This was the last gadget — every gadget now writes DOM only in
    onStateChange (bar the two documented upstream-faithful exceptions).
    
    Co-Authored-By: default avatarClaude Opus 4.8 <noreply@anthropic.com>
    973514b0