Merge branch 'main' of https://git.azuze.fr/kawa/SharepointToolbox-Web
This commit is contained in:
@@ -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 */ }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user