Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit ccc2f52

Browse files
committed
refactor: deprecate transfer http cache
This commit deprecates a number of APIs. DEPRECATED: `StateTransferInitializerModule`, `TransferHttpCacheInterceptor` and `domContentLoadedFactory` have been deprecated in favor of `provideClientHydration`. See: https://angular.io/api/platform-browser/provideClientHydration
1 parent b771ef1 commit ccc2f52

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

modules/common/src/state-transfer-initializer/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# State Transfer Initializer
22

3+
## Deprecated Use [`provideClientHydration`](https://angular.io/api/platform-browser/provideClientHydration) instead which caches HTTP requests by default.
4+
35
Delays the app bootstrap process to ensure that the DOM content is loaded before state transfer initilization
46

57
Simply import the module into your project and you will no longer need to wrap your component bootstrap function in an `DOMContentLoaded` callback

modules/common/src/state-transfer-initializer/module.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
import { DOCUMENT } from '@angular/common';
1010
import { APP_INITIALIZER, NgModule } from '@angular/core';
1111

12+
/**
13+
* @deprecated Use `provideClientHydration` instead which caches HTTP requests by default.
14+
* @see https://angular.io/api/platform-browser/provideClientHydration
15+
*/
1216
export function domContentLoadedFactory(doc: Document): () => Promise<void> {
1317
return () =>
1418
new Promise((resolve, _reject) => {
@@ -27,6 +31,10 @@ export function domContentLoadedFactory(doc: Document): () => Promise<void> {
2731
});
2832
}
2933

34+
/**
35+
* @deprecated Use `provideClientHydration` instead which caches HTTP requests by default.
36+
* @see https://angular.io/api/platform-browser/provideClientHydration
37+
*/
3038
@NgModule({
3139
providers: [
3240
{

modules/common/src/transfer_http.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ function getHeadersMap(headers: HttpHeaders): Record<string, string[]> {
5050
return headersMap;
5151
}
5252

53+
/**
54+
* @deprecated Use `provideClientHydration` instead which caches HTTP requests by default.
55+
* @see https://angular.io/api/platform-browser/provideClientHydration
56+
*/
5357
@Injectable()
5458
export class TransferHttpCacheInterceptor implements HttpInterceptor {
5559
private isCacheActive = true;

0 commit comments

Comments
 (0)