@@ -31,10 +31,12 @@ namespace Uno.WebAssembly.Bootstrap {
31
31
32
32
const webAppBasePath = this . _unoConfig . environmentVariables [ "UNO_BOOTSTRAP_WEBAPP_BASE_PATH" ] ;
33
33
34
+ // This assumes that the runtime includes the header as an env var:
35
+ // https://github.com/dotnet/runtime/blob/79a71fc750652191eba18e19b3f98492e882cb5f/src/mono/browser/runtime/loader/config.ts#L336
36
+ const browserToolsVariable = ( < any > this . _context ) . config . environmentVariables [ 'ASPNETCORE-BROWSER-TOOLS' ] ;
37
+
34
38
// Take the place of the internal .NET for WebAssembly APIs for metadata updates coming
35
39
// from the "BrowserLink" feature.
36
- const bootstrapContext = this . _context ;
37
-
38
40
( function ( Blazor ) {
39
41
Blazor . _internal = {
40
42
initialize : function ( ) {
@@ -45,21 +47,11 @@ namespace Uno.WebAssembly.Bootstrap {
45
47
46
48
applyExisting : async function ( ) : Promise < void > {
47
49
48
- var hotreloadConfigResponse = await fetch ( `/_framework/unohotreload` ) ;
49
-
50
- var modifiableAssemblies = hotreloadConfigResponse . headers . get ( 'DOTNET-MODIFIABLE-ASSEMBLIES' ) ;
51
- var aspnetCoreBrowserTools = hotreloadConfigResponse . headers . get ( 'ASPNETCORE-BROWSER-TOOLS' ) ;
52
-
53
- if ( modifiableAssemblies ) {
54
- bootstrapContext . MONO . mono_wasm_setenv ( 'DOTNET_MODIFIABLE_ASSEMBLIES' , modifiableAssemblies ) ;
55
- }
56
-
57
- // To uncomment once https://github.com/dotnet/aspnetcore/issues/37357#issuecomment-941237000 is released
58
- // if (aspnetCoreBrowserTools == "true")
50
+ if ( browserToolsVariable == "true" )
59
51
{
60
52
try {
61
53
var m = < any > await import ( `/_framework/blazor-hotreload.js` ) ;
62
- m . receiveHotReload ( ) ;
54
+ await m . receiveHotReloadAsync ( ) ;
63
55
}
64
56
catch ( e ) {
65
57
console . error ( `Failed to apply initial metadata delta ${ e } ` ) ;
@@ -72,15 +64,15 @@ namespace Uno.WebAssembly.Bootstrap {
72
64
return HotReloadSupport . _getApplyUpdateCapabilitiesMethod ( ) ;
73
65
} ,
74
66
75
- applyHotReload : function ( moduleId : any , metadataDelta : any , ilDelta : any , pdbDelta : any ) {
67
+ applyHotReload : function ( moduleId : any , metadataDelta : any , ilDelta : any , pdbDelta : any , updatedTypes : any ) {
76
68
this . initialize ( ) ;
77
- return HotReloadSupport . _applyHotReloadDeltaMethod ( moduleId , metadataDelta , ilDelta , pdbDelta || "" ) ;
69
+ return HotReloadSupport . _applyHotReloadDeltaMethod ( moduleId , metadataDelta , ilDelta , pdbDelta || "" , updatedTypes || [ ] ) ;
78
70
}
79
71
} ;
80
72
} ) ( ( < any > window ) . Blazor || ( ( < any > window ) . Blazor = { } ) ) ;
81
73
82
74
// Apply pending updates caused by a browser refresh
83
- ( < any > window ) . Blazor . _internal . initialize ( bootstrapContext . BINDING ) ;
75
+ ( < any > window ) . Blazor . _internal . initialize ( ) ;
84
76
await ( < any > window ) . Blazor . _internal . applyExisting ( ) ;
85
77
}
86
78
}
0 commit comments