Skip to content

Commit 0b3677e

Browse files
brandonrobertsAndrewKushnir
authored andcommitted
fix(http): ensure new cache state is returned on each request (#49749)
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
1 parent 8272b5b commit 0b3677e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/common/http/src/transfer_cache.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,13 @@ function generateHash(value: string): string {
146146
*/
147147
export function withHttpTransferCache(): Provider[] {
148148
return [
149-
{provide: CACHE_STATE, useValue: {isCacheActive: true}}, {
149+
{
150+
provide: CACHE_STATE,
151+
useFactory: () => {
152+
return {isCacheActive: true};
153+
}
154+
},
155+
{
150156
provide: HTTP_ROOT_INTERCEPTOR_FNS,
151157
useValue: transferCacheInterceptorFn,
152158
multi: true,

0 commit comments

Comments
 (0)