Skip to content

Commit 9754c34

Browse files
authored
Merge pull request #7189 from nextcloud-libraries/backport/7185/stable8
[stable8] fix(useIsDarkTheme): provide default value to silence runtime warnings
2 parents 2f637f8 + 085599f commit 9754c34

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
@@ -55,7 +55,7 @@ const useInternalIsDarkTheme = createSharedComposable(() => useIsDarkThemeElemen
5555
*/
5656
export function useIsDarkTheme(): DeepReadonly<Ref<boolean>> {
5757
const isDarkTheme = useInternalIsDarkTheme()
58-
const enforcedTheme = inject(INJECTION_KEY_THEME)
58+
const enforcedTheme = inject(INJECTION_KEY_THEME, undefined)
5959

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

0 commit comments

Comments
 (0)