Changeset 3cd1aaa in Klonkt for src/middleware/render.js


Ignore:
Timestamp:
06/17/2026 12:03:39 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
44cf44d
Parents:
108fd5f
Message:

Hub: chrome in #pcms-chrome slot + out-of-band swap on htmx → header always correct, audio never jumps

The site chrome (topnav/profile header/view-switcher) now lives in a fixed
slot #pcms-chrome. On every htmx partial, render.js renders that chrome
out-of-band (chrome.ejs with oob=true) so htmx replaces it with the chrome
of the NEW page/artist — while the audio player (separate in document.body)
stays alive. Result: hub-home has no header (hero=header, empty slot), each
artist gets its own header (no stale "Studio Noord on Luna"), and music
never jumps on navigation. Solo/circle: chrome refreshes identically (no-op
in terms of content).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/middleware/render.js

    r108fd5f r3cd1aaa  
    122122      }).replace(/[€-￿]/g, (ch) => '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0'));
    123123      res.setHeader('HX-Trigger-After-Settle', triggerJson);
    124       return res.send(pageContent);
     124      // Site-chrome out-of-band mee-renderen, zodat de kop (topnav/profielkop/
     125      // view-switcher) bij navigatie ALTIJD bij de nieuwe pagina/artiest hoort —
     126      // terwijl de audioplayer (los in document.body) blijft leven (geen
     127      // verspringen). htmx vervangt #pcms-chrome via hx-swap-oob. Niet kritisch:
     128      // faalt 't, dan blijft de oude chrome staan (geen crash).
     129      let oobChrome = '';
     130      try {
     131        oobChrome = await ejs.renderFile(
     132          path.join(VIEWS_DIR, 'partials', 'chrome.ejs'),
     133          { ...locals, oob: true },
     134          { async: false },
     135        );
     136      } catch (e) { /* chrome-OOB overslaan */ }
     137      return res.send(pageContent + oobChrome);
    125138    }
    126139
Note: See TracChangeset for help on using the changeset viewer.