Skip to content

Commit 777dfdd

Browse files
committed
refactor(@schematics/angular): remove redundant withEventReplay from provideClientHydration
`withEventReplay` and incremental hydration are now enabled by default when using `provideClientHydration()`. Since incremental hydration automatically depends on and enables event replay, explicitly passing `withEventReplay()` is no longer necessary. See: angular/angular#68114
1 parent 74e7dbe commit 777dfdd

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

packages/schematics/angular/server/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,7 @@ const serverSchematic: RuleFactory<ServerOptions> = createProjectSchematic(
248248
addRootProvider(
249249
options.project,
250250
({ code, external }) =>
251-
code`${external('provideClientHydration', '@angular/platform-browser')}(${external(
252-
'withEventReplay',
253-
'@angular/platform-browser',
254-
)}())`,
251+
code`${external('provideClientHydration', '@angular/platform-browser')}()`,
255252
),
256253
]);
257254
},

packages/schematics/angular/server/index_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe('Server Schematic', () => {
172172
it(`should add 'provideClientHydration' to the providers list`, async () => {
173173
const tree = await schematicRunner.runSchematic('server', defaultOptions, appTree);
174174
const contents = tree.readContent('/projects/bar/src/app/app-module.ts');
175-
expect(contents).toContain(`provideClientHydration(withEventReplay())`);
175+
expect(contents).toContain(`provideClientHydration()`);
176176
});
177177
});
178178

@@ -257,7 +257,7 @@ describe('Server Schematic', () => {
257257
it(`should add 'provideClientHydration' to the providers list`, async () => {
258258
const tree = await schematicRunner.runSchematic('server', defaultOptions, appTree);
259259
const contents = tree.readContent('/projects/bar/src/app/app.config.ts');
260-
expect(contents).toContain(`provideClientHydration(withEventReplay())`);
260+
expect(contents).toContain(`provideClientHydration()`);
261261
});
262262
});
263263

0 commit comments

Comments
 (0)