Skip to content

Commit

Permalink
fix(http): ensure new cache state is returned on each request (#49749)
Browse files Browse the repository at this point in the history
The cache state is only used only the first server request. Restarting the server uses the cache on first request.

Subsequent requests skip the cache because the value is mutated.

This change ensures a new cache state is returned on every request.

PR Close #49749
  • Loading branch information
brandonroberts authored and AndrewKushnir committed Apr 11, 2023
1 parent a6475a1 commit 9f0c6d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/common/http/src/transfer_cache.ts
Expand Up @@ -146,7 +146,13 @@ function generateHash(value: string): string {
*/
export function withHttpTransferCache(): Provider[] {
return [
{provide: CACHE_STATE, useValue: {isCacheActive: true}}, {
{
provide: CACHE_STATE,
useFactory: () => {
return {isCacheActive: true};
}
},
{
provide: HTTP_ROOT_INTERCEPTOR_FNS,
useValue: transferCacheInterceptorFn,
multi: true,
Expand Down

0 comments on commit 9f0c6d1

Please sign in to comment.