fix(config): don't shadow env-provided font CSS with Nunito defaults#125
Open
aymericcousaert wants to merge 1 commit into
Open
fix(config): don't shadow env-provided font CSS with Nunito defaults#125aymericcousaert wants to merge 1 commit into
aymericcousaert wants to merge 1 commit into
Conversation
When the operator provides a font configuration via env (typically THEME_BODY_FONT_FAMILY_CSS or THEME_BODY_FONT_FAMILY), the lib's Nunito defaults from @data-fair/lib-common-types still merged in under the override. Because the env value lives in 'themeOverrides' and the lib default lives in 'defaultTheme', and only the env CSS was provided, the final config ended up shipping both: the lib's Nunito @font-face block prepended in front of the operator's CSS rules, plus 'bodyFontFamily: Nunito' silently overriding the (unset) operator font name. Net effect: operators who wired up THEME_BODY_FONT_FAMILY_CSS via their installer (e.g. MyDataCatalogue's installer ships an Inter CSS block pointing at /studio/assets/fonts/inter/...) saw _public.js advertise bodyFontFamily='Nunito' anyway, and the @font-face declarations from the lib's Nunito shadowed the operator's Inter rules. When the operator provides any font config, drop the matching lib defaults before merging so the env-provided values win cleanly. The no-env path is unchanged — Nunito is still the SD default when nothing else is set. Tested via a new unit spec (config-theme-font-merge.unit.spec.ts) that asserts the three cases: - no env → Nunito stays - env CSS provided → lib Nunito stripped, env CSS wins - env name provided → lib Nunito stripped, env name wins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the operator provides a font configuration via env (typically
THEME_BODY_FONT_FAMILY_CSSorTHEME_BODY_FONT_FAMILY), the lib's Nunito defaults from@data-fair/lib-common-typesstill merged in under the override. Because the env value lives inthemeOverridesand the lib default lives indefaultTheme, and only the env CSS was provided, the final config ended up shipping both: the lib's Nunito@font-faceblock prepended in front of the operator's CSS rules, plusbodyFontFamily: Nunitosilently overriding the (unset) operator font name.Net effect: operators who wired up
THEME_BODY_FONT_FAMILY_CSSvia their installer (e.g. MyDataCatalogue's installer ships an Inter CSS block pointing at/studio/assets/fonts/inter/...) saw_public.jsadvertisebodyFontFamily='Nunito'anyway, and the@font-facedeclarations from the lib's Nunito shadowed the operator's Inter rules.When the operator provides any font config, drop the matching lib defaults before merging so the env-provided values win cleanly. The no-env path is unchanged — Nunito is still the SD default when nothing else is set.
Test plan
New unit spec
tests/features/config-theme-font-merge.unit.spec.tsasserts the three cases: