Skip to content

Commit

Permalink
Add naive fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-tengler committed Apr 13, 2024
1 parent ed99eb6 commit caac508
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/HotChocolate/Caching/src/Caching/QueryCacheMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal sealed class QueryCacheMiddleware
{
private readonly ICacheControlOptions _options;
private readonly RequestDelegate _next;

private QueryCacheMiddleware(
RequestDelegate next,
[SchemaService] ICacheControlOptionsAccessor optionsAccessor)
Expand Down Expand Up @@ -48,15 +48,18 @@ queryResult.ContextData is not null
contextData.Add(CacheControlHeaderValue, cacheControlHeaderValue);

context.Result = new QueryResult(
queryResult.Data,
queryResult.Errors,
queryResult.Extensions,
contextData,
queryResult.Items,
queryResult.Incremental,
queryResult.Label,
queryResult.Path,
queryResult.HasNext);
data: queryResult.Data,
errors: queryResult.Errors,
extension: queryResult.Extensions,
contextData: contextData,
items: queryResult.Items,
incremental: queryResult.Incremental,
label: queryResult.Label,
path: queryResult.Path,
hasNext: queryResult.HasNext,
// TODO: This is probably problematic
cleanupTasks: [],
isDataSet: queryResult.IsDataSet);
}
}

Expand All @@ -67,4 +70,4 @@ internal static RequestCoreMiddleware Create()
var middleware = new QueryCacheMiddleware(next, options);
return context => middleware.InvokeAsync(context);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="HotChocolate.Caching" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
Expand Down

0 comments on commit caac508

Please sign in to comment.