-
Notifications
You must be signed in to change notification settings - Fork 95
fix(useIsDarkTheme): provide default value to silence runtime warnings #7185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/backport to stable8 |
| export function useIsDarkTheme(): DeepReadonly<Ref<boolean>> { | ||
| const isDarkTheme = useInternalIsDarkTheme() | ||
| const enforcedTheme = inject(INJECTION_KEY_THEME) | ||
| const enforcedTheme = inject(INJECTION_KEY_THEME, computed<''>(() => '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not undefined, to not create additional computed?
| const enforcedTheme = inject(INJECTION_KEY_THEME, computed<''>(() => '')) | |
| const enforcedTheme = inject(INJECTION_KEY_THEME, undefined) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Antreesy in production build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far noticed only while testing 9.0.0-rc.4 against this branch.
Maybe a result of #7157
6c59210 to
d2acae7
Compare
Otherwise if no `NcThemeProvider` is used a runtime warning is shown in the dev tools console. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
d2acae7 to
35829a4
Compare


☑️ Resolves
Otherwise if no
NcThemeProvideris used a runtime warning is shown in the dev tools console.🏁 Checklist
stable8for maintained Vue 2 version or not applicable