Skip to content

Commit 06e943f

Browse files
authored
Merge pull request #7185 from nextcloud-libraries/fix/theme-warning
fix(useIsDarkTheme): provide default value to silence runtime warnings
2 parents 92274f5 + 35829a4 commit 06e943f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/composables/useIsDarkTheme/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ import type { ComputedRef, InjectionKey } from 'vue'
1010
*
1111
* @private
1212
*/
13-
export const INJECTION_KEY_THEME: InjectionKey<ComputedRef<'light' | 'dark' | ''>> = Symbol.for('nc:theme:enforced')
13+
export const INJECTION_KEY_THEME: InjectionKey<ComputedRef<'light' | 'dark' | ''> | undefined> = Symbol.for('nc:theme:enforced')

src/composables/useIsDarkTheme/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const useInternalIsDarkTheme = createSharedComposable(() => useIsDarkThemeElemen
5454
*/
5555
export function useIsDarkTheme(): DeepReadonly<Ref<boolean>> {
5656
const isDarkTheme = useInternalIsDarkTheme()
57-
const enforcedTheme = inject(INJECTION_KEY_THEME)
57+
const enforcedTheme = inject(INJECTION_KEY_THEME, undefined)
5858

5959
return computed(() => {
6060
if (enforcedTheme?.value) {

0 commit comments

Comments
 (0)