Skip to content

Commit 8287624

Browse files
crisbetopkozlowski-opensource
authored andcommitted
fix(core): ensure type is preserved during HMR (#59700)
Fixes an internal HMR issue where the type might be replaced when swapping out the definition. Externally this is a no-op. PR Close #59700
1 parent d634ca7 commit 8287624

File tree

1 file changed

+5
-0
lines changed
  • packages/core/src/render3

1 file changed

+5
-0
lines changed

packages/core/src/render3/hmr.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ function mergeWithExistingDefinition(
116116
// Preserve the old `setInput` function, because it has some state.
117117
// This is fine, because the component instance is preserved as well.
118118
setInput: clone.setInput,
119+
120+
// Externally this is redundant since we redeclare the definition using the original type.
121+
// Internally we may receive a definition with an alternate, but identical, type so we have
122+
// to ensure that the original one is preserved.
123+
type: clone.type,
119124
});
120125

121126
ngDevMode && assertEqual(replacement, currentDef, 'Expected definition to be merged in place');

0 commit comments

Comments
 (0)