Skip to content

Commit 673ce35

Browse files
authored
Add API to Renderer to trigger a UI refresh on hot reload (#30884)
* Add API to Renderer to trigger a UI refresh on hot reload Fixes dotnet/aspnetcore#30816
1 parent c893796 commit 673ce35

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Boot.WebAssembly.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ async function boot(options?: Partial<WebAssemblyStartOptions>): Promise<void> {
3838

3939
Blazor._internal.InputFile = WasmInputFile;
4040

41+
Blazor._internal.applyHotReload = (id: string, metadataDelta: string, ilDeta: string) => {
42+
DotNet.invokeMethod('Microsoft.AspNetCore.Components.WebAssembly', 'ApplyHotReloadDelta', id, metadataDelta, ilDeta);
43+
};
44+
4145
// Configure JS interop
4246
Blazor._internal.invokeJSFromDotNet = invokeJSFromDotNet;
4347

src/GlobalExports.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ interface IBlazor {
4545
readSatelliteAssemblies?: () => System_Array<System_Object>,
4646
getLazyAssemblies?: any
4747
dotNetCriticalError?: any
48-
getSatelliteAssemblies?: any
48+
getSatelliteAssemblies?: any,
49+
applyHotReload?: (id: string, metadataDelta: string, ilDelta: string) => void
4950
}
5051
}
5152

@@ -61,4 +62,4 @@ export const Blazor: IBlazor = {
6162
};
6263

6364
// Make the following APIs available in global scope for invocation from JS
64-
window['Blazor'] = Blazor;
65+
window['Blazor'] = Blazor;

0 commit comments

Comments
 (0)