Refactor theme change handler for safe async updates
Refactored OnThemeChanged in MainLayout.razor to use InvokeAsync for proper synchronization of UI updates and async logic, preventing threading issues. Also added a blank line after app.Run() in Program.cs (no functional impact).
This commit is contained in:
@@ -50,13 +50,14 @@
|
||||
await ApplyDxDarkOverrideAsync();
|
||||
}
|
||||
|
||||
private async void OnThemeChanged()
|
||||
private void OnThemeChanged()
|
||||
{
|
||||
StateHasChanged();
|
||||
if (_isInteractive)
|
||||
InvokeAsync(async () =>
|
||||
{
|
||||
await ApplyDxDarkOverrideAsync();
|
||||
}
|
||||
StateHasChanged();
|
||||
if (_isInteractive)
|
||||
await ApplyDxDarkOverrideAsync();
|
||||
});
|
||||
}
|
||||
|
||||
private async Task ApplyDxDarkOverrideAsync()
|
||||
|
||||
Reference in New Issue
Block a user