Skip to content

Commit 2cbfdfe

Browse files
ironAiken2claude
andcommitted
fix(FR-3834): seed the Branding draft from the saved domain document
The editor draft (and so the JSON modal) was always seeded from the shipped theme.json, even when the domain had an applied document. The domain getter existed and was tested but the editor never read it. Seed from the domain document first, then theme.json — what the Branding comment and the PR already described. Reset still restores the shipped values. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByYKF612aRtRCXZWfExDuf
1 parent 6d63a43 commit 2cbfdfe

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

react/src/hooks/useDefaultTheme.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { App } from '../app-shim';
66
import {
77
APPEARANCE_SCHEMA_VERSION,
8+
getDomainAppearanceConfig,
89
getStaticAppearanceConfig,
910
} from '../helper/customThemeConfig';
1011
import { useBAISettingUserState } from './useBAISetting';
@@ -30,20 +31,19 @@ export const useDefaultTheme = () => {
3031
'custom_theme_config',
3132
);
3233

33-
// Seed the draft from the SHIPPED document (never from `rawThemeConfig`:
34-
// in preview mode that IS the draft, so reseeding from it would loop). A
35-
// draft from before the v2 format (no schemaVersion) is reseeded rather
36-
// than edited — its v1 paths no longer mean anything to the editor.
37-
// Note: useBAISettingUserState returns null (not undefined) when
38-
// localStorage has no value.
34+
// Seed the draft from the saved domain document, else the SHIPPED one —
35+
// never from `rawThemeConfig`, which in preview mode IS the draft and would
36+
// loop. A draft from before the v2 format (no schemaVersion) is reseeded
37+
// rather than edited. Note: useBAISettingUserState returns null (not
38+
// undefined) when localStorage has no value.
3939
const initializeDefaultTheme = useEffectEvent(() => {
40-
const shipped = getStaticAppearanceConfig();
40+
const seed = getDomainAppearanceConfig() ?? getStaticAppearanceConfig();
4141
if (
4242
(_.isNil(defaultTheme) ||
4343
defaultTheme.schemaVersion !== APPEARANCE_SCHEMA_VERSION) &&
44-
!_.isNil(shipped)
44+
!_.isNil(seed)
4545
) {
46-
setDefaultTheme(_.cloneDeep(shipped));
46+
setDefaultTheme(_.cloneDeep(seed));
4747
}
4848
});
4949
useEffect(() => {

0 commit comments

Comments
 (0)