fix(ssr): remove spider-only gate — serve full SSR to all users #13

Closed
robot wants to merge 1 commits from fix/ssr-for-all-users into main
pull from: fix/ssr-for-all-users
Member

Problem

Regular browser users were served a CSR shell (empty <app-root>) instead of server-rendered content. The browser painted a blank page, then waited for Angular to bootstrap and lazy-load the route — causing a visible blank-to-content flash.

Fix

All requests now route through the Angular SSR engine (appEngine.handle()). The SSR engine already fetches fresh station config from the API via APP_INITIALIZER before rendering, so the first paint carries real content, colors, and assets.

Changes

  • server.ts: Removed spider-only SSR gate. Removed unused isSpider/getUserAgent imports. Kept serveCsrShell as dead code for now (future fallback).
  • server.spec.ts: Updated tests to verify no spider gate exists and SSR engine is used for all requests.

Why this works

The SSR engine (main.server.ts) already blocks rendering until stationConfig.load() resolves. This means every request — spider or human — gets HTML with real DB data. The cost concern that motivated spider-only SSR is moot: SSR is fast enough for the site traffic.

## Problem Regular browser users were served a CSR shell (empty `<app-root>`) instead of server-rendered content. The browser painted a blank page, then waited for Angular to bootstrap and lazy-load the route — causing a visible blank-to-content flash. ## Fix All requests now route through the Angular SSR engine (`appEngine.handle()`). The SSR engine already fetches fresh station config from the API via `APP_INITIALIZER` before rendering, so the first paint carries real content, colors, and assets. ## Changes - **server.ts:** Removed spider-only SSR gate. Removed unused `isSpider`/`getUserAgent` imports. Kept `serveCsrShell` as dead code for now (future fallback). - **server.spec.ts:** Updated tests to verify no spider gate exists and SSR engine is used for all requests. ## Why this works The SSR engine (main.server.ts) already blocks rendering until `stationConfig.load()` resolves. This means every request — spider or human — gets HTML with real DB data. The cost concern that motivated spider-only SSR is moot: SSR is fast enough for the site traffic.
robot added 1 commit 2026-08-09 01:16:21 -07:00
fix(ssr): remove spider-only gate — serve full SSR to all users
CI Pipeline / backend-test (pull_request) Successful in 9m46s
CI Pipeline / frontend-test (pull_request) Successful in 23s
CI Pipeline / frontend-build (pull_request) Successful in 30s
CI Pipeline / backend-lint (pull_request) Successful in 8s
CI Pipeline / quality-gate (push) Successful in 2s
CI Pipeline / backend-test (push) Successful in 9m58s
CI Pipeline / frontend-test (push) Successful in 23s
CI Pipeline / frontend-build (push) Successful in 29s
CI Pipeline / backend-lint (push) Successful in 8s
CI Pipeline / quality-gate (pull_request) Successful in 2s
83b79fe0da
The CSR shell served to regular browsers caused a visible blank-to-content
flash: the browser painted an empty <app-root>, then waited for Angular
to bootstrap and lazy-load the route before any content appeared.

All requests now route through the Angular SSR engine (appEngine.handle()),
which fetches fresh station config from the API via APP_INITIALIZER before
rendering. The first paint carries real content, colors, and assets.
kfj001 closed this pull request 2026-08-09 01:31:21 -07:00
kfj001 deleted branch fix/ssr-for-all-users 2026-08-09 01:31:24 -07:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WesternTechnologies/kmtnflower#13