diff --git a/plugins/career/screen.js b/plugins/career/screen.js index 7600735..4e47db1 100644 --- a/plugins/career/screen.js +++ b/plugins/career/screen.js @@ -1192,7 +1192,21 @@ if (typeof window.setViz === 'function') window.setViz('venue'); } catch (_) { /* viz optional — restore stays intact */ } } + // Push the gig's venue pack to the crowd layer NOW. + // + // crowd.setManifest(venue) is reached only through pushCrowdManifest, + // and pushCrowdManifest is called only from refresh() — the career + // tab's own reload. A gig navigates AWAY from the career tab to the + // player, so refresh() never runs during it, and setting the override + // above does nothing on its own. The result the testers saw: the venue + // visualization turns on (3D highway) but its crowd/stage pack never + // loads, so the song plays over the bare highway backdrop ("standard + // particles"), or over whatever venue a previous refresh() happened to + // leave applied. We just changed the override to this gig's venue, so + // re-push for it. _state is the career state the booking screen already + // fetched; guard for the rare null. _appliedManifestVenue = null; + if (_state) pushCrowdManifest(_state); _ppGigRun = { songs: prop.songs, venue_id: prop.venue_id, diff --git a/tests/js/career_plugin.test.js b/tests/js/career_plugin.test.js index f038727..d7f0405 100644 --- a/tests/js/career_plugin.test.js +++ b/tests/js/career_plugin.test.js @@ -116,3 +116,30 @@ test('career screen pushes the crowd manifest with a base URL', () => { // Degrades without the crowd layer (PR1 not merged / older desktop). assert.match(src, /typeof crowd\.setManifest !== 'function'\) return/); }); + +// feedBack#… (tester): "Venue doesn't load when starting song from passport. +// Loads standard particles." crowd.setManifest(venue) is reached ONLY through +// pushCrowdManifest, and pushCrowdManifest is called ONLY from refresh() (the +// career tab's own reload). A gig navigates away from that tab, so refresh() +// never runs during it — the venue viz turns on but its crowd/stage pack never +// loads. startGig must push the manifest itself after setting the override. +test('startGig pushes the crowd manifest for the gig venue', () => { + const fs = require('node:fs'); + const path = require('node:path'); + const src = fs.readFileSync( + path.join(__dirname, '..', '..', 'plugins', 'career', 'screen.js'), 'utf8'); + const start = src.indexOf('async function startGig('); + assert.ok(start !== -1, 'startGig not found'); + const open = src.indexOf('{', src.indexOf(')', start)); + let depth = 1, i = open + 1; + while (i < src.length && depth > 0) { const ch = src[i]; if (ch === '{') depth++; else if (ch === '}') depth--; i++; } + const fn = src.slice(start, i); + // The override is set, then the manifest must be (re)pushed for it. + const overrideIdx = fn.search(/VENUE_OVERRIDE_KEY,\s*prop\.venue_id/); + const pushIdx = fn.search(/pushCrowdManifest\s*\(/); + assert.ok(overrideIdx !== -1, 'startGig must set the venue override'); + assert.ok(pushIdx !== -1, + 'startGig must push the crowd manifest — refresh() (its only other caller) ' + + 'never runs during a gig, so the venue pack would never load'); + assert.ok(overrideIdx < pushIdx, 'the manifest must be pushed AFTER the override is set to the gig venue'); +});