Summary
Starting from v6.7.4, resolveSiteGlobals() was moved from withSiteGlobals() into loadCmsPageInternal (inside cmsRoute.ts). This means it now runs on every CMS route, regardless of whether the site uses the withSiteGlobals() wrapper.
This is an undocumented breaking change for sites that use cmsRouteConfig without withSiteGlobals().
What changed
Before 6.7.4 (withSiteGlobals.ts):
resolveSiteGlobals() was only called inside the withSiteGlobals() wrapper
- Sites using
cmsRouteConfig alone had globals (including Theme section) silently not rendered
- The site's
:root CSS fallbacks were used for all custom properties
From 6.7.4 (cmsRoute.ts, comment references #233):
// Resolve page sections and site globals in parallel. Globals are merged
// into the same `resolvedSections` array so the path through this server
// function is identical for SSR (F5) and SPA (<Link>) navigations — see
// #233 for the previous SPA-breakage when `withSiteGlobals` ran client-side
const [enrichedSections, globals] = await Promise.all([
runSectionLoaders(page.resolvedSections, request),
resolveSiteGlobals(),
]);
resolveSiteGlobals() now runs unconditionally on all routes
- Globals (e.g.
Theme section from site.json) are rendered everywhere
- This silently activates sections that the site had no idea were being injected
Impact
Sites that relied on globals NOT being rendered now have them injected without any code change on their end. In the lebiscuit project this manifested as:
- The
Theme section (registered in site.json → "theme") now renders a <style> block into every page
- The
Theme.tsx toValue() function emitted bare oklch components (47.81% 0.20 29deg) instead of full oklch(...) values
- These variables override the
:root fallback hex values in app.css
- Tailwind v4's
@theme { --color-brand-primary-1: var(--brand-primary-1) } now resolves to invalid CSS, breaking all custom colors site-wide
The site went from working colors to completely broken colors between 6.6.1 → 6.7.4 with no changes to the site's own code.
Reproduction
- Create a site using
cmsRouteConfig without withSiteGlobals()
- Have a
Theme section registered in site.json
- Run with 6.6.1 → Theme does NOT render,
:root fallback CSS is used ✅
- Upgrade to 6.7.4+ → Theme now renders, overrides
:root CSS variables ❌
Suggested fix
Either:
Option A — Document it as a breaking change in the CHANGELOG for 6.7.4, with a migration guide for sites that didn't use withSiteGlobals():
If your Theme section emits CSS variables, ensure the format matches what your app.css :root block expects (e.g. full oklch(...) vs bare components).
Option B — Add a flag to cmsRouteConfig to opt out of automatic globals resolution:
cmsRouteConfig({ resolveGlobals: false })
Option C — Validate that sections injected via resolveSiteGlobals() emit valid CSS custom property values (at least warn in dev when a <style> block contains malformed values).
Environment
@decocms/start: 6.6.1 → 6.22.1 (breaking introduced in 6.7.4)
- Tailwind v4 + DaisyUI v5
cmsRouteConfig used without withSiteGlobals() wrapper
Summary
Starting from v6.7.4,
resolveSiteGlobals()was moved fromwithSiteGlobals()intoloadCmsPageInternal(insidecmsRoute.ts). This means it now runs on every CMS route, regardless of whether the site uses thewithSiteGlobals()wrapper.This is an undocumented breaking change for sites that use
cmsRouteConfigwithoutwithSiteGlobals().What changed
Before 6.7.4 (
withSiteGlobals.ts):resolveSiteGlobals()was only called inside thewithSiteGlobals()wrappercmsRouteConfigalone had globals (includingThemesection) silently not rendered:rootCSS fallbacks were used for all custom propertiesFrom 6.7.4 (
cmsRoute.ts, comment references #233):resolveSiteGlobals()now runs unconditionally on all routesThemesection fromsite.json) are rendered everywhereImpact
Sites that relied on globals NOT being rendered now have them injected without any code change on their end. In the lebiscuit project this manifested as:
Themesection (registered insite.json → "theme") now renders a<style>block into every pageTheme.tsxtoValue()function emitted bare oklch components (47.81% 0.20 29deg) instead of fulloklch(...)values:rootfallback hex values inapp.css@theme { --color-brand-primary-1: var(--brand-primary-1) }now resolves to invalid CSS, breaking all custom colors site-wideThe site went from working colors to completely broken colors between 6.6.1 → 6.7.4 with no changes to the site's own code.
Reproduction
cmsRouteConfigwithoutwithSiteGlobals()Themesection registered insite.json:rootfallback CSS is used ✅:rootCSS variables ❌Suggested fix
Either:
Option A — Document it as a breaking change in the CHANGELOG for 6.7.4, with a migration guide for sites that didn't use
withSiteGlobals():Option B — Add a flag to
cmsRouteConfigto opt out of automatic globals resolution:Option C — Validate that sections injected via
resolveSiteGlobals()emit valid CSS custom property values (at least warn in dev when a<style>block contains malformed values).Environment
@decocms/start: 6.6.1 → 6.22.1 (breaking introduced in 6.7.4)cmsRouteConfigused withoutwithSiteGlobals()wrapper