File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
WebAssembly/WebAssembly/src Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 3939 </PropertyGroup >
4040
4141 <ItemGroup >
42+ <Compile Include =" $(ComponentsSharedSourceRoot)src\HotReloadManager.cs" LinkBase =" HotReload" />
4243 <Compile Include =" $(ComponentsSharedSourceRoot)src\CacheHeaderSettings.cs" Link =" Shared\CacheHeaderSettings.cs" />
4344 <Compile Include =" $(ComponentsSharedSourceRoot)src\ArrayBuilder.cs" LinkBase =" Circuits" />
4445 <Compile Include =" $(ComponentsSharedSourceRoot)src\RenderBatchWriter.cs" LinkBase =" Circuits" />
Original file line number Diff line number Diff line change 11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4+ using Microsoft . AspNetCore . Components . HotReload ;
45using System . Collections . Concurrent ;
56using System . Diagnostics . CodeAnalysis ;
67using System . Reflection ;
@@ -12,10 +13,28 @@ namespace Microsoft.AspNetCore.Components;
1213#endif
1314
1415// A cache for root component types
15- internal sealed class RootTypeCache
16+ internal sealed class RootTypeCache : IDisposable
1617{
1718 private readonly ConcurrentDictionary < Key , Type ? > _typeToKeyLookUp = new ( ) ;
1819
20+ public RootTypeCache ( )
21+ {
22+ if ( HotReloadManager . Default . MetadataUpdateSupported )
23+ {
24+ HotReloadManager . Default . OnDeltaApplied += ClearCache ;
25+ }
26+ }
27+
28+ internal void ClearCache ( ) => _typeToKeyLookUp . Clear ( ) ;
29+
30+ public void Dispose ( )
31+ {
32+ if ( HotReloadManager . Default . MetadataUpdateSupported )
33+ {
34+ HotReloadManager . Default . OnDeltaApplied -= ClearCache ;
35+ }
36+ }
37+
1938 public Type ? GetRootType ( string assembly , string type )
2039 {
2140 var key = new Key ( assembly , type ) ;
Original file line number Diff line number Diff line change 2424 </ItemGroup >
2525
2626 <ItemGroup >
27+ <Compile Include =" $(ComponentsSharedSourceRoot)src\HotReloadManager.cs" LinkBase =" HotReload" />
2728 <Compile Include =" $(ComponentsSharedSourceRoot)src\BrowserNavigationManagerInterop.cs" />
2829 <Compile Include =" $(ComponentsSharedSourceRoot)src\PullFromJSDataStream.cs" />
2930 <Compile Include =" $(ComponentsSharedSourceRoot)src\TransmitDataStreamToJS.cs" />
You can’t perform that action at this time.
0 commit comments