Skip to content

Commit 4ff4639

Browse files
committed
fix(hub-ui): preserve empty scheme values
1 parent 7478e2f commit 4ff4639

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { afterEach, describe, expect, it } from 'vitest'
2+
import { setBranding, useBrandingBackground } from './branding'
3+
import { setColorSchemePreference } from './color-mode'
4+
5+
afterEach(() => {
6+
setBranding({})
7+
setColorSchemePreference('auto')
8+
})
9+
10+
describe('useBrandingBackground', () => {
11+
it('preserves an empty dark value for CSS validation', () => {
12+
expect.assertions(1)
13+
14+
setColorSchemePreference('dark')
15+
setBranding({ background: { light: 'white', dark: '' } })
16+
17+
expect(useBrandingBackground().value).toBe('')
18+
})
19+
})

packages/hub-ui/src/client/state/branding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function resolveColorSchemeValue(value: ColorSchemeValue | undefined, dark: bool
6161
return undefined
6262
if (typeof value === 'string')
6363
return value
64-
return dark ? (value.dark || value.light) : value.light
64+
return dark ? (value.dark ?? value.light) : value.light
6565
}
6666

6767
// --- Applying to the DOM --------------------------------------------------

0 commit comments

Comments
 (0)