angular/packages/core
Kristiyan Kostadinov 9714b65d99 fix(core): replace metadata in place during HMR (#59644)
Currently during HMR we swap out the entire module definition (e.g. `MyComp.ɵcmp = newDef`). In standalone components and most module-based ones this works fine, however in some cases (e.g. circular dependencies) the compiler can produce a `setComponentScope` call for a module-based component. This call doesn't make it into the HMR replacement function, because it is defined in the module's file, not the component's. As a result, the dependencies of these components are cleared out upon replacement.

A secondary problem is that the `directiveDefs` and `pipeDefs` fields can save references to definitions that later become stale as a result of HMR.

These changes resolve both issues by:
1. Performing the replacement by copying the properties from the new definition onto the old one, while keeping it in place.
2. Preserving the initial `directiveDefs`, `pipeDefs` and `setInput`.

Fixes #59639.

PR Close #59644
2025-01-21 09:50:27 -08:00
..
global refactor(docs-infra): use interpolation instead of innerHTML for better perf (#58913) 2024-11-27 10:59:18 +01:00
primitives refactor(core): move linkedSignal implementation to primitives (#59501) 2025-01-21 07:58:09 -08:00
rxjs-interop refactor(core): port resource() to linkedSignal() (#59024) 2025-01-16 09:22:46 -08:00
schematics test(migrations): add test for earlier fix (#59497) 2025-01-13 11:10:18 -05:00
src fix(core): replace metadata in place during HMR (#59644) 2025-01-21 09:50:27 -08:00
test fix(core): replace metadata in place during HMR (#59644) 2025-01-21 09:50:27 -08:00
testing refactor: replace ɵPendingTasks with ɵPendingTasksInternal (#59138) 2024-12-10 13:45:07 -08:00
BUILD.bazel refactor(platform-server): Add an ssr benchmark setup. (#57647) 2024-10-04 10:45:22 -07:00
index.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
package.json build: update zone.js peer dependency for core package to 0.15.0 (#57431) 2024-08-21 13:17:52 -07:00
PACKAGE.md
public_api.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00