Skip to content

Commit d004eda

Browse files
Apply Co-Pilot suggestion
1 parent d4a3cdd commit d004eda

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/HotChocolate/Core/src/Execution/Configuration/DefaultRequestExecutorOptionsMonitor.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@
22

33
namespace HotChocolate.Execution.Configuration;
44

5-
internal sealed class DefaultRequestExecutorOptionsMonitor(IOptionsMonitor<RequestExecutorSetup> optionsMonitor)
5+
internal sealed class DefaultRequestExecutorOptionsMonitor(
6+
IOptionsMonitor<RequestExecutorSetup> optionsMonitor)
67
: IRequestExecutorOptionsMonitor
78
{
89
public RequestExecutorSetup Get(string schemaName) => optionsMonitor.Get(schemaName);
910

10-
public IDisposable OnChange(Action<string> listener) => NoOpListener.Instance;
11-
12-
private sealed class NoOpListener : IDisposable
13-
{
14-
public void Dispose()
15-
{
16-
}
17-
18-
public static NoOpListener Instance { get; } = new();
19-
}
11+
public IDisposable? OnChange(Action<string> listener)
12+
=> optionsMonitor.OnChange((_, schemaName) => listener(schemaName!));
2013
}

src/HotChocolate/Core/src/Execution/Configuration/IRequestExecutorOptionsMonitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ public interface IRequestExecutorOptionsMonitor
2121
/// <returns>
2222
/// An <see cref="IDisposable"/> which should be disposed to stop listening for changes.
2323
/// </returns>
24-
IDisposable OnChange(Action<string> listener);
24+
IDisposable? OnChange(Action<string> listener);
2525
}

0 commit comments

Comments
 (0)