Skip to content

Commit

Permalink
Make HotReloadService optional
Browse files Browse the repository at this point in the history
  • Loading branch information
captainsafia committed Aug 23, 2023
1 parent 7855989 commit 8855f40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class RazorComponentEndpointDataSource<[DynamicallyAccessedMembers(Comp
private readonly IApplicationBuilder _applicationBuilder;
private readonly RenderModeEndpointProvider[] _renderModeEndpointProviders;
private readonly RazorComponentEndpointFactory _factory;
private readonly HotReloadService _hotReloadService;
private readonly HotReloadService? _hotReloadService;
private List<Endpoint>? _endpoints;
private CancellationTokenSource _cancellationTokenSource;
private IChangeToken _changeToken;
Expand All @@ -38,7 +38,7 @@ public RazorComponentEndpointDataSource(
IEnumerable<RenderModeEndpointProvider> renderModeEndpointProviders,
IApplicationBuilder applicationBuilder,
RazorComponentEndpointFactory factory,
HotReloadService hotReloadService)
HotReloadService? hotReloadService)
{
_builder = builder;
_applicationBuilder = applicationBuilder;
Expand Down Expand Up @@ -137,7 +137,7 @@ private void UpdateEndpoints()
_cancellationTokenSource = new CancellationTokenSource();
_changeToken = new CancellationChangeToken(_cancellationTokenSource.Token);
oldCancellationTokenSource?.Cancel();
if (_hotReloadService.MetadataUpdateSupported)
if (_hotReloadService is { MetadataUpdateSupported : true })
{
ChangeToken.OnChange(_hotReloadService.GetChangeToken, UpdateEndpoints);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ internal class RazorComponentEndpointDataSourceFactory
{
private readonly RazorComponentEndpointFactory _factory;
private readonly IEnumerable<RenderModeEndpointProvider> _providers;
private readonly HotReloadService _hotReloadService;
private readonly HotReloadService? _hotReloadService;

public RazorComponentEndpointDataSourceFactory(
RazorComponentEndpointFactory factory,
IEnumerable<RenderModeEndpointProvider> providers,
HotReloadService hotReloadService)
HotReloadService? hotReloadService)
{
_factory = factory;
_providers = providers;
Expand Down

0 comments on commit 8855f40

Please sign in to comment.