diff --git a/DiunaBI.UI.Shared/Extensions/ServiceCollectionExtensions.cs b/DiunaBI.UI.Shared/Extensions/ServiceCollectionExtensions.cs index 01f5c4b..87f58fa 100644 --- a/DiunaBI.UI.Shared/Extensions/ServiceCollectionExtensions.cs +++ b/DiunaBI.UI.Shared/Extensions/ServiceCollectionExtensions.cs @@ -39,6 +39,7 @@ public static class ServiceCollectionExtensions }); // Services + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -48,11 +49,9 @@ public static class ServiceCollectionExtensions services.AddScoped(); services.AddScoped(); - // SignalR Hub Service (singleton for global connection shared across all users) - services.AddSingleton(sp => + // SignalR Hub Service (scoped per user session for authenticated connections) + services.AddScoped(sp => { - // For singleton, we can't inject scoped services directly - // We'll get them from the service provider when needed var logger = sp.GetRequiredService>(); var tokenProvider = sp.GetRequiredService(); return new EntityChangeHubService(apiBaseUrl, sp, logger, tokenProvider);