After PR #9 (SSR infrastructure), the SSR server was running correctly but still rendered DEFAULT_CONFIG (hardcoded colors, assets, content) instead of real DB values. Users saw stale defaults on every initial paint.
Root Cause
The isPlatformBrowser guard in App.ngOnInit() exited early on the server, so stationConfig.load() never ran during SSR. The SSR infrastructure was working (nginx proxying to Node server correctly) — the app code just never fetched the config.
Fix
Two-part fix:
main.server.ts: Added an APP_INITIALIZER that blocks server rendering until stationConfig.load() resolves. Uses isPlatformServer so it only blocks on the server — is a no-op in the browser to avoid blocking the client.
app.ts: Moved stationConfig.load() before the isPlatformBrowser guard so ngOnInit also fetches config on the server as a safety net.
Result
SSR HTML now contains real DB values (colors, hero icon, station name, etc.) instead of build-time defaults — eliminating the stale-asset flash reported by users.
Files Changed
src/main.server.ts — Added APP_INITIALIZER for server-side config fetch
src/app/app.ts — Moved stationConfig.load() before isPlatformBrowser guard
## Problem
After PR #9 (SSR infrastructure), the SSR server was running correctly but still rendered `DEFAULT_CONFIG` (hardcoded colors, assets, content) instead of real DB values. Users saw stale defaults on every initial paint.
## Root Cause
The `isPlatformBrowser` guard in `App.ngOnInit()` exited early on the server, so `stationConfig.load()` never ran during SSR. The SSR infrastructure was working (nginx proxying to Node server correctly) — the app code just never fetched the config.
## Fix
Two-part fix:
1. **`main.server.ts`**: Added an `APP_INITIALIZER` that blocks server rendering until `stationConfig.load()` resolves. Uses `isPlatformServer` so it only blocks on the server — is a no-op in the browser to avoid blocking the client.
2. **`app.ts`**: Moved `stationConfig.load()` before the `isPlatformBrowser` guard so `ngOnInit` also fetches config on the server as a safety net.
## Result
SSR HTML now contains real DB values (colors, hero icon, station name, etc.) instead of build-time defaults — eliminating the stale-asset flash reported by users.
## Files Changed
- `src/main.server.ts` — Added APP_INITIALIZER for server-side config fetch
- `src/app/app.ts` — Moved stationConfig.load() before isPlatformBrowser guard
The isPlatformBrowser guard in App.ngOnInit() was blocking
stationConfig.load() on the server, so SSR always rendered with
DEFAULT_CONFIG (hardcoded colors, assets, content).
Two-part fix:
- main.server.ts: Add APP_INITIALIZER that blocks server rendering
until station config is fetched from the API. Only runs on the
server — is a no-op in the browser to avoid blocking the client.
- app.ts: Move stationConfig.load() before the isPlatformBrowser
guard so ngOnInit also calls it on the server as a safety net.
This ensures SSR HTML contains real DB values (colors, hero icon,
station name, etc.) instead of build-time defaults — eliminating
the stale-asset flash reported by users.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
After PR #9 (SSR infrastructure), the SSR server was running correctly but still rendered
DEFAULT_CONFIG(hardcoded colors, assets, content) instead of real DB values. Users saw stale defaults on every initial paint.Root Cause
The
isPlatformBrowserguard inApp.ngOnInit()exited early on the server, sostationConfig.load()never ran during SSR. The SSR infrastructure was working (nginx proxying to Node server correctly) — the app code just never fetched the config.Fix
Two-part fix:
main.server.ts: Added anAPP_INITIALIZERthat blocks server rendering untilstationConfig.load()resolves. UsesisPlatformServerso it only blocks on the server — is a no-op in the browser to avoid blocking the client.app.ts: MovedstationConfig.load()before theisPlatformBrowserguard songOnInitalso fetches config on the server as a safety net.Result
SSR HTML now contains real DB values (colors, hero icon, station name, etc.) instead of build-time defaults — eliminating the stale-asset flash reported by users.
Files Changed
src/main.server.ts— Added APP_INITIALIZER for server-side config fetchsrc/app/app.ts— Moved stationConfig.load() before isPlatformBrowser guardc0b538a7ccto54bd869042