Skip to content

Remove IComponentContext #13132

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

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ private void CreateServiceProvider()
services.AddSingleton(_BrowserHostBuilderContext);
services.AddSingleton<IWebAssemblyHost, WebAssemblyHost>();
services.AddSingleton<IJSRuntime>(WebAssemblyJSRuntime.Instance);
services.AddSingleton<IComponentContext, WebAssemblyComponentContext>();
services.AddSingleton<NavigationManager>(WebAssemblyNavigationManager.Instance);
services.AddSingleton<INavigationInterception>(WebAssemblyNavigationInterception.Instance);
services.AddSingleton<ILoggerFactory, WebAssemblyLoggerFactory>();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ public partial interface IComponent
void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle);
System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters);
}
public partial interface IComponentContext
{
bool IsConnected { get; }
}
public partial interface IHandleAfterRender
{
System.Threading.Tasks.Task OnAfterRenderAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ public partial interface IComponent
void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle);
System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters);
}
public partial interface IComponentContext
{
bool IsConnected { get; }
}
public partial interface IHandleAfterRender
{
System.Threading.Tasks.Task OnAfterRenderAsync();
Expand Down
19 changes: 0 additions & 19 deletions src/Components/Components/src/IComponentContext.cs

This file was deleted.

4 changes: 1 addition & 3 deletions src/Components/Components/src/Routing/Router.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ static readonly ReadOnlyDictionary<string, object> _emptyParametersDictionary

[Inject] private INavigationInterception NavigationInterception { get; set; }

[Inject] private IComponentContext ComponentContext { get; set; }

[Inject] private ILoggerFactory LoggerFactory { get; set; }

/// <summary>
Expand Down Expand Up @@ -152,7 +150,7 @@ private void OnLocationChanged(object sender, LocationChangedEventArgs args)

Task IHandleAfterRender.OnAfterRenderAsync()
{
if (!_navigationInterceptionEnabled && ComponentContext.IsConnected)
if (!_navigationInterceptionEnabled)
{
_navigationInterceptionEnabled = true;
return NavigationInterception.EnableNavigationInterceptionAsync();
Expand Down
2 changes: 0 additions & 2 deletions src/Components/Server/src/Circuits/DefaultCircuitFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ public override CircuitHost CreateCircuitHost(

var scope = _scopeFactory.CreateScope();
var jsRuntime = (RemoteJSRuntime)scope.ServiceProvider.GetRequiredService<IJSRuntime>();
var componentContext = (RemoteComponentContext)scope.ServiceProvider.GetRequiredService<IComponentContext>();
jsRuntime.Initialize(client);
componentContext.Initialize(client);

var navigationManager = (RemoteNavigationManager)scope.ServiceProvider.GetRequiredService<NavigationManager>();
var navigationInterception = (RemoteNavigationInterception)scope.ServiceProvider.GetRequiredService<INavigationInterception>();
Expand Down
19 changes: 0 additions & 19 deletions src/Components/Server/src/Circuits/RemoteComponentContext.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public static IServerSideBlazorBuilder AddServerSideBlazor(this IServiceCollecti
services.AddScoped<NavigationManager, RemoteNavigationManager>();
services.AddScoped<IJSRuntime, RemoteJSRuntime>();
services.AddScoped<INavigationInterception, RemoteNavigationInterception>();
services.AddScoped<IComponentContext, RemoteComponentContext>();
services.AddScoped<AuthenticationStateProvider, ServerAuthenticationStateProvider>();

services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CircuitOptions>, CircuitOptionsJSInteropDetailedErrorsConfiguration>());
Expand Down
46 changes: 0 additions & 46 deletions src/Components/Server/test/Circuits/RemoteComponentContextTest.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@page "/prerendered-interop"
@using Microsoft.AspNetCore.Components
@using Microsoft.JSInterop
@inject IComponentContext ComponentContext
@inject IJSRuntime JSRuntime

<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@page "/prerendered-transition"
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Authorization
@inject IComponentContext ComponentContext

<CascadingAuthenticationState>
<AuthorizeView>
Expand All @@ -11,7 +10,7 @@

<p>
Current state:
<strong id="connected-state">@(ComponentContext.IsConnected ? "connected" : "not connected")</strong>
<strong id="connected-state">@(hasRenderedInConnectedMode ? "connected" : "not connected")</strong>
</p>

<p>
Expand All @@ -22,11 +21,13 @@
</CascadingAuthenticationState>

@code {
bool hasRenderedInConnectedMode;
int count;
protected override Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
hasRenderedInConnectedMode = true;
// We need to queue another render when we connect, otherwise the
// browser won't see anything.
StateHasChanged();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ internal static void AddViewServices(IServiceCollection services)
services.TryAddScoped<StaticComponentRenderer>();
services.TryAddScoped<NavigationManager, HttpNavigationManager>();
services.TryAddScoped<IJSRuntime, UnsupportedJavaScriptRuntime>();
services.TryAddScoped<IComponentContext, UnsupportedComponentContext>();
services.TryAddScoped<INavigationInterception, UnsupportedNavigationInterception>();

services.TryAddTransient<ControllerSaveTempDataPropertyFilter>();
Expand Down

This file was deleted.