-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MudThemeProvider: Fix BL0007, avoid direct parameter writes, remove MudThemingProvider, and other improvements #8712
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #8712 +/- ##
==========================================
+ Coverage 89.82% 90.09% +0.26%
==========================================
Files 412 419 +7
Lines 11878 12190 +312
Branches 2364 2400 +36
==========================================
+ Hits 10670 10982 +312
+ Misses 681 668 -13
- Partials 527 540 +13 ☔ View full report in Codecov by Sentry. |
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.
Ran it on my prod app that has custom colors and System/Light/Dark modes and all seems the same
Removed |
As discussed lets name it to the old name |
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.
@ScarletKuro thanks . Probably need to add <MudPopoverProvider/>
in a few places
src/MudBlazor.Docs/Pages/Getting Started/Layouts/Examples/LayoutBasicFunctionalityExample.razor
Show resolved
Hide resolved
src/MudBlazor.Docs/Pages/Getting Started/Layouts/Examples/LayoutBasicAppbarExample.razor
Outdated
Show resolved
Hide resolved
src/MudBlazor.Docs/Pages/Getting Started/Layouts/Examples/LayoutBasicMudBlazorExample.razor
Show resolved
Hide resolved
I think that's all places, let me know if I missed something, |
...r.Docs/Pages/Getting Started/Installation/Examples/InstallationManualComponentsExample.razor
Outdated
Show resolved
Hide resolved
@ScarletKuro Thanks 👍 |
Maybe we should change the title for release notes? MudThemeProvider: Fix BL0007, not write to parameter directly, remove MudThemingProvider and other improvements (#8712)? |
Added to v7.0.0 Migration Guide #8447 |
…udThemingProvider, and other improvements (MudBlazor#8712)
Description
IsDarkMode
is using ParamterState framework.I couldn't really do the same for
Theme
as I don't thinkBuildTheme
can be made async because of thisMudBlazor/src/MudBlazor/Components/ThemeProvider/MudThemingProvider.razor
Line 15 in e1de7c8
So I ended up doing in old fashion. Let me know if I'm wrong.
watchDarkThemeMedia
is now automatically subscribed on first render, it's necessary because otherwise two way bindingIsDarkMode
will never ever be called if you don't callWatchSystemPreference()
which I don't think is a good default behavior, otherwise theIsDarkMode
shouldn't be two way bindable at all.Added JS
stopWatchingDarkThemeMedia
to unsubscribe from the event (before it never was), I know there is only one theme provider during the lifetime, but I think when you use automode you will end up having two subscription and this is not desired (but this is theory, I'm not an auto user), it doesn't bring any harm, just allocated additional memory if it stays.Did an overall cleanup of the JS script:
darkThemeMediaQuery
was defined, yet only used for single function, when it could be reused.dotNetHelper
indarkModeChange
wasn't used, it's not needed.e
wasn't used, which is a small mistake, because you are invoking the matchMedia once again, when you already got a result.How Has This Been Tested?
Visually, but just docs, I don't know if i should tests some other scenarios? pls, let me know
New simple bUnit tests.
Type of Changes
Checklist
dev
).