Skip to content

Commit fb95f5c

Browse files
committed
Cleanup
1 parent 03bdce3 commit fb95f5c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Components/Web/src/WebRenderer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public WebRenderer(
4242

4343
// Supply a DotNetObjectReference to JS that it can use to call us back for events etc.
4444
jsComponentInterop.AttachToRenderer(this);
45-
4645
var jsRuntime = serviceProvider.GetRequiredService<IJSRuntime>();
4746
AttachWebRendererInterop(jsRuntime, jsonOptions, jsComponentInterop);
4847
}
@@ -104,6 +103,8 @@ protected override void Dispose(bool disposing)
104103
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "<Pending>")]
105104
private void AttachWebRendererInterop(IJSRuntime jsRuntime, JsonSerializerOptions jsonOptions, JSComponentInterop jsComponentInterop)
106105
{
106+
const string JSMethodIdentifier = "Blazor._internal.attachWebRendererInterop";
107+
107108
object[] args = [
108109
_rendererId,
109110
_interopMethodsReference,
@@ -118,11 +119,11 @@ private void AttachWebRendererInterop(IJSRuntime jsRuntime, JsonSerializerOption
118119
newJsonOptions.TypeInfoResolverChain.Add(WebRendererSerializerContext.Default);
119120
newJsonOptions.TypeInfoResolverChain.Add(JsonConverterFactoryTypeInfoResolver<DotNetObjectReference<WebRendererInteropMethods>>.Instance);
120121
var argsJson = JsonSerializer.Serialize(args, newJsonOptions);
121-
inProcessRuntime.InvokeJS("Blazor._internal.attachWebRendererInterop", argsJson, JSCallResultType.JSVoidResult, 0);
122+
inProcessRuntime.InvokeJS(JSMethodIdentifier, argsJson, JSCallResultType.JSVoidResult, 0);
122123
}
123124
else
124125
{
125-
jsRuntime.InvokeVoidAsync("Blazor._internal.attachWebRendererInterop", args).Preserve();
126+
jsRuntime.InvokeVoidAsync(JSMethodIdentifier, args).Preserve();
126127
}
127128
}
128129

0 commit comments

Comments
 (0)