Skip to content

Commit 08ea105

Browse files
JeanMechemattrbeck
authored andcommitted
refactor(platform-server): split zone/zoneless tests.
The Zone tests are a subset of tests that we still using the Zone CD provider.
1 parent 63d8005 commit 08ea105

File tree

5 files changed

+708
-684
lines changed

5 files changed

+708
-684
lines changed

packages/core/src/hydration/api.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ import {performanceMarkFeature} from '../util/performance';
2929
import {NgZone} from '../zone';
3030
import {withEventReplay} from './event_replay';
3131

32+
import {
33+
ChangeDetectionScheduler,
34+
NotificationSource,
35+
} from '../change_detection/scheduling/zoneless_scheduling';
36+
import {DEHYDRATED_BLOCK_REGISTRY, DehydratedBlockRegistry} from '../defer/registry';
37+
import {processAndInitTriggers} from '../defer/triggering';
38+
import {DOCUMENT} from '../document';
39+
import {DOC_PAGE_BASE_URL} from '../error_details_base_url';
3240
import {cleanupDehydratedViews} from './cleanup';
3341
import {
3442
enableClaimDehydratedIcuCaseImpl,
3543
enablePrepareI18nBlockForHydrationImpl,
3644
setIsI18nHydrationSupportEnabled,
3745
} from './i18n';
46+
import {gatherDeferBlocksCommentNodes} from './node_lookup_utils';
3847
import {
3948
IS_HYDRATION_DOM_REUSE_ENABLED,
4049
IS_I18N_HYDRATION_ENABLED,
@@ -52,11 +61,6 @@ import {
5261
verifySsrContentsIntegrity,
5362
} from './utils';
5463
import {enableFindMatchingDehydratedViewImpl} from './views';
55-
import {DEHYDRATED_BLOCK_REGISTRY, DehydratedBlockRegistry} from '../defer/registry';
56-
import {gatherDeferBlocksCommentNodes} from './node_lookup_utils';
57-
import {processAndInitTriggers} from '../defer/triggering';
58-
import {DOCUMENT} from '../document';
59-
import {DOC_PAGE_BASE_URL} from '../error_details_base_url';
6064

6165
/**
6266
* Indicates whether the hydration-related code was added,
@@ -277,6 +281,7 @@ export function withDomHydration(): EnvironmentProviders {
277281
{
278282
provide: APP_BOOTSTRAP_LISTENER,
279283
useFactory: () => {
284+
const scheduler = inject(ChangeDetectionScheduler);
280285
if (inject(IS_HYDRATION_DOM_REUSE_ENABLED)) {
281286
const appRef = inject(ApplicationRef);
282287

@@ -304,6 +309,8 @@ export function withDomHydration(): EnvironmentProviders {
304309
countBlocksSkippedByHydration(appRef.injector);
305310
printHydrationStats(appRef.injector);
306311
}
312+
// We need to schedule the execution of the render hooks because the hydration cleanup alters the DOM.
313+
scheduler.notify(NotificationSource.RenderHook);
307314
});
308315
};
309316
}

packages/platform-server/test/BUILD.bazel

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//tools:defaults.bzl", "angular_jasmine_test", "ts_project")
1+
load("//tools:defaults.bzl", "angular_jasmine_test", "ts_project", "zoneless_jasmine_test")
22

33
ts_project(
44
name = "dom_utils",
@@ -65,6 +65,7 @@ ts_project(
6565
],
6666
)
6767

68+
# This target is meant to run with Zone.js as some test cases are shared between Zone & Zoneless.
6869
angular_jasmine_test(
6970
name = "test",
7071
data = [
@@ -73,7 +74,7 @@ angular_jasmine_test(
7374
],
7475
)
7576

76-
angular_jasmine_test(
77+
zoneless_jasmine_test(
7778
name = "event_replay_test",
7879
data = [
7980
":event_replay_test_lib",

0 commit comments

Comments
 (0)