fix(ssr): remove color defaults from :root in _themes.scss #12

Merged
robot merged 2 commits from fix/remove-root-color-defaults into main 2026-08-09 00:17:03 -07:00
Member

Problem

When visiting the test site on a normal browser, the prerendered/stale color scheme flashes briefly before the dynamic site loads.

The SSR server correctly injects fresh color CSS custom properties as an inline <style> block before </head>. However, _themes.scss also compiles color defaults on :root into the styles-*.css stylesheet, and that stylesheet loads after the server-injected block, overwriting the correct colors with build-time defaults.

The cascade order:

  1. Server-injected <style> with correct colors from API
  2. Compiled styles-*.css with hardcoded defaults (overwrites #1)
  3. ThemeService.apply() corrects colors after Angular boots (too late)

Fix

Remove all color CSS custom properties from :root in _themes.scss. Non-color properties (fonts, radii, shadows) remain as they do not change between deploys.

Now the server-injected <style> is the sole source of truth for colors at first paint.

## Problem When visiting the test site on a normal browser, the prerendered/stale color scheme flashes briefly before the dynamic site loads. The SSR server correctly injects fresh color CSS custom properties as an inline <style> block before </head>. However, _themes.scss also compiles color defaults on :root into the styles-*.css stylesheet, and that stylesheet loads after the server-injected block, overwriting the correct colors with build-time defaults. The cascade order: 1. Server-injected <style> with correct colors from API 2. Compiled styles-*.css with hardcoded defaults (overwrites #1) 3. ThemeService.apply() corrects colors after Angular boots (too late) ## Fix Remove all color CSS custom properties from :root in _themes.scss. Non-color properties (fonts, radii, shadows) remain as they do not change between deploys. Now the server-injected <style> is the sole source of truth for colors at first paint.
robot added 1 commit 2026-08-08 22:59:21 -07:00
fix(ssr): remove color defaults from :root in _themes.scss
CI Pipeline / backend-test (push) Successful in 9m55s
CI Pipeline / frontend-test (push) Successful in 23s
CI Pipeline / frontend-build (push) Successful in 29s
CI Pipeline / backend-lint (push) Successful in 9s
CI Pipeline / backend-test (pull_request) Successful in 9m56s
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 / quality-gate (pull_request) Successful in 1s
e78a725839
The SSR server injects fresh color CSS custom properties as an inline
<style> block before </head>, but _themes.scss also set hardcoded
color defaults on :root at build time. The two :root blocks compete
in the cascade — the compiled stylesheet (loaded after the inline
<style>) overwrites the server-injected colors, causing a visible
flash where wrong colors render briefly before ThemeService.apply()
corrects them.

Removing the color properties from :root in _themes.scss makes the
server-injected <style> the sole source of truth for colors. Non-color
properties (fonts, radii, shadows) remain as build-time defaults since
they don't change between deploys.
robot added 1 commit 2026-08-08 23:49:54 -07:00
fix(ssr): inject derived gradients and migrate component SCSS to CSS vars
CI Pipeline / backend-test (push) Successful in 9m52s
CI Pipeline / frontend-test (push) Successful in 24s
CI Pipeline / frontend-build (push) Successful in 30s
CI Pipeline / backend-lint (push) Successful in 9s
CI Pipeline / backend-test (pull_request) Successful in 9m59s
CI Pipeline / frontend-test (pull_request) Successful in 23s
CI Pipeline / frontend-build (pull_request) Successful in 31s
CI Pipeline / backend-lint (pull_request) Successful in 8s
CI Pipeline / quality-gate (push) Successful in 2s
CI Pipeline / quality-gate (pull_request) Successful in 2s
bb45e8d6ae
The server-injected inline <style> was missing the three derived gradient
variables (--sky-gradient, --sunset-gradient, --mixed-gradient) that
components reference via var(). Without them, components fell back to
SCSS build-time defaults on the first paint, causing a visible flash
before ThemeService.apply() corrected the values.

Additionally, migrate three component SCSS files from hardcoded SCSS
color variables to CSS custom properties so the first paint uses the
server-injected runtime colors:
- login.component.scss: backgrounds, text colors, borders, focus rings
- events.component.scss: event date card background gradient
- about.component.scss: donation CTA background gradient
kfj001 approved these changes 2026-08-09 00:01:26 -07:00
robot merged commit db402f8192 into main 2026-08-09 00:17:03 -07:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WesternTechnologies/kmtnflower#12