mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Problem Loading https://vocalstar.nomadkaraoke.com briefly showed the Nomad logo (and on `/en/`, the whole consumer landing page) before the Vocal Star branding appeared. The static export is prerendered with default branding; the tenant swap only happens after hydration (measured: Nomad logo in DOM at ~2ms, tenant logo at ~111ms, longer on cold loads). The tab title also stayed "Nomad Karaoke: Generator". ## Fix - Edge Pages Function (already knows the tenant) now also: - sets `<html data-tenant-pending>` + `html[data-tenant-pending] body{visibility:hidden}`, with a 4s safety reveal if JS never runs - preloads the tenant logo - replaces `<title>` with the tenant's `site_title` - `TenantProvider` removes the marker once tenant config is initialised (parent effect → runs after the tenant UI has committed; also on config-fetch failure). - Injection logic moved from `functions/[[path]].ts` into `lib/edge/tenantHtmlInjection.ts` so it is unit-tested. Non-tenant hosts are untouched. ## Testing - New: `lib/__tests__/tenant-html-injection.test.ts` (hide/reveal script executed in jsdom, timeout reveal, preload, title escaping, XSS escaping, gs:// logo mapping, non-tenant passthrough) and `components/__tests__/tenant-provider-reveal.test.tsx` (page is revealed only after tenant branding rendered; revealed on fetch failure). - Full frontend jest: 138 suites / 1704 tests pass. CodeRabbit local review: no findings. - Post-deploy: verify on vocalstar.nomadkaraoke.com with a Playwright img/visibility timeline. @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Gp5fBmsmWJxgkEHb4JfhXR Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>