Skip to content

Commit 03a14b5

Browse files
AndrewKushnirthePunderWoman
authored andcommitted
refactor(core): invoke setActiveConsumer in ɵɵdeferHydrateWhen at the right time (#58864)
This commit updates the code of the `ɵɵdeferHydrateWhen` function to invoke the `setActiveConsumer` function at the right time (currently, we invoke it in the `finally` block, which is too late). PR Close #58864
1 parent 21106bf commit 03a14b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/core/src/defer/instructions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export function ɵɵdeferHydrateWhen(rawValue: unknown) {
262262
// We are on the server and SSR for defer blocks is enabled.
263263
triggerDeferBlock(lView, tNode);
264264
} else {
265+
const prevConsumer = setActiveConsumer(null);
265266
try {
266267
const value = Boolean(rawValue); // handle truthy or falsy values
267268
if (value === true) {
@@ -274,7 +275,6 @@ export function ɵɵdeferHydrateWhen(rawValue: unknown) {
274275
triggerHydrationFromBlockName(injector, ssrUniqueId);
275276
}
276277
} finally {
277-
const prevConsumer = setActiveConsumer(null);
278278
setActiveConsumer(prevConsumer);
279279
}
280280
}

0 commit comments

Comments
 (0)