7
7
using System . Text . Json ;
8
8
using System . Threading ;
9
9
using System . Threading . Tasks ;
10
- using Microsoft . AspNetCore . Components . Rendering ;
11
- using Microsoft . AspNetCore . Components . Routing ;
12
10
using Microsoft . AspNetCore . Components . Web ;
13
11
using Microsoft . AspNetCore . Components . Web . Rendering ;
14
12
using Microsoft . Extensions . DependencyInjection ;
@@ -57,7 +55,7 @@ public CircuitHost(
57
55
CircuitClientProxy client ,
58
56
RendererRegistry rendererRegistry ,
59
57
RemoteRenderer renderer ,
60
- IList < ComponentDescriptor > descriptors ,
58
+ IReadOnlyList < ComponentDescriptor > descriptors ,
61
59
RemoteJSRuntime jsRuntime ,
62
60
CircuitHandler [ ] circuitHandlers ,
63
61
ILogger logger )
@@ -92,24 +90,10 @@ public CircuitHost(
92
90
93
91
public RendererRegistry RendererRegistry { get ; }
94
92
95
- public IList < ComponentDescriptor > Descriptors { get ; }
93
+ public IReadOnlyList < ComponentDescriptor > Descriptors { get ; }
96
94
97
95
public IServiceProvider Services { get ; }
98
96
99
- public Task < ComponentRenderedText > PrerenderComponentAsync ( Type componentType , ParameterView parameters )
100
- {
101
- return Renderer . Dispatcher . InvokeAsync ( async ( ) =>
102
- {
103
- var result = await Renderer . RenderComponentAsync ( componentType , parameters ) ;
104
-
105
- // When we prerender we start the circuit in a disconnected state. As such, we only call
106
- // OnCircuitOpenenedAsync here and when the client reconnects we run OnConnectionUpAsync
107
- await OnCircuitOpenedAsync ( CancellationToken . None ) ;
108
-
109
- return result ;
110
- } ) ;
111
- }
112
-
113
97
public void SetCircuitUser ( ClaimsPrincipal user )
114
98
{
115
99
var authenticationStateProvider = Services . GetService < AuthenticationStateProvider > ( ) as IHostEnvironmentAuthenticationStateProvider ;
@@ -120,26 +104,6 @@ public void SetCircuitUser(ClaimsPrincipal user)
120
104
}
121
105
}
122
106
123
- internal void InitializeCircuitAfterPrerender ( UnhandledExceptionEventHandler unhandledException )
124
- {
125
- if ( ! _initialized )
126
- {
127
- _initialized = true ;
128
- UnhandledException += unhandledException ;
129
- var uriHelper = ( RemoteUriHelper ) Services . GetRequiredService < IUriHelper > ( ) ;
130
- if ( ! uriHelper . HasAttachedJSRuntime )
131
- {
132
- uriHelper . AttachJsRuntime ( JSRuntime ) ;
133
- }
134
-
135
- var navigationInterception = ( RemoteNavigationInterception ) Services . GetRequiredService < INavigationInterception > ( ) ;
136
- if ( ! navigationInterception . HasAttachedJSRuntime )
137
- {
138
- navigationInterception . AttachJSRuntime ( JSRuntime ) ;
139
- }
140
- }
141
- }
142
-
143
107
internal void SendPendingBatches ( )
144
108
{
145
109
// Dispatch any buffered renders we accumulated during a disconnect.
@@ -233,7 +197,8 @@ await Renderer.Dispatcher.InvokeAsync(async () =>
233
197
// That's because AddComponentAsync waits for quiescence, which can take
234
198
// arbitrarily long. In the meantime we might need to be receiving and
235
199
// processing incoming JSInterop calls or similar.
236
- for ( var i = 0 ; i < Descriptors . Count ; i ++ )
200
+ var count = Descriptors . Count ;
201
+ for ( var i = 0 ; i < count ; i ++ )
237
202
{
238
203
var ( componentType , domElementSelector , prerendered ) = Descriptors [ i ] ;
239
204
if ( ! prerendered )
0 commit comments