This commit is contained in:
2026-06-02 17:39:58 +02:00
36 changed files with 2520 additions and 463 deletions
+9 -7
View File
@@ -23,7 +23,15 @@ public class UserSessionService : IUserSessionService
{
_sessionManager = sessionManager;
_settingsRepo = settingsRepo;
_ = LoadSettingsAsync();
// Load synchronously so Settings (esp. Lang) are available the moment the circuit
// starts — culture is applied in MainLayout.OnInitialized before any page renders,
// so a fire-and-forget load here would race and lose.
//
// Run on the thread pool (Task.Run) so LoadAsync's await continuation does NOT post
// back to the circuit's SynchronizationContext. Blocking that context here with a plain
// GetResult() deadlocks: the continuation can never resume on the thread we're blocking.
try { _settings = Task.Run(() => _settingsRepo.LoadAsync()).GetAwaiter().GetResult(); }
catch { /* use defaults */ }
}
public void SetProfile(TenantProfile profile)
@@ -45,10 +53,4 @@ public class UserSessionService : IUserSessionService
_settings = settings;
_ = _settingsRepo.SaveAsync(settings);
}
private async Task LoadSettingsAsync()
{
try { _settings = await _settingsRepo.LoadAsync(); }
catch { /* use defaults */ }
}
}