This project is mirrored from https://github.com/angular/angular.git.
Pull mirroring updated .
- Jan 23, 2025
-
-
Andrew Kushnir authored
-
- Jan 22, 2025
-
-
Jens Kuehlers authored
PR Close #59661
-
Kristiyan Kostadinov authored
fix(migrations): avoid applying the same replacements twice when cleaning up unused imports (#59656) If a file ends up in multiple programs, the unused imports migration was counting it twice. This was fine since the string replacements were handling it correctly, but it was printing out incorrect data. These changes rework the migration to de-duplicate the replacements and produce the data from the de-duplicated results. PR Close #59656
-
Andrew Kushnir authored
This commit updates a flaky test to increase the amount of work (more `for` loop iterations) to minimize the chance of getting the same timestamp after that work. PR Close #59653
-
Pawel Kozlowski authored
Move TNode manipulation logic to its own file and update existing refereces. PR Close #59601
-
Charles Lyding authored
Updates the HMR dependencies extraction logic to handle new expressions. For example, `deps: [[new Optional(), dep]]`. PR Close #59637
-
Charles Lyding authored
Updates the HMR dependencies extraction logic to handle conditional expressions. For example, `providers: [condition ? providersA : providersB]`. PR Close #59637
-
Kristiyan Kostadinov authored
The component ID collision check tries to account for components being replaced by checking for the `type`, however that might not work during SSR. These changes disable the warning since it's primarily useful on the browser anyways. PR Close #59625
-
Kristiyan Kostadinov authored
Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly. PR Close #59644
-
Kristiyan Kostadinov authored
Fixes that the async animations renderer didn't have the logic to clean up its style cache during HMR. This is identical to #59393. Fixes #59640. PR Close #59644
-
Kristiyan Kostadinov authored
Fixes that we were filtering out the component itself from the set of dependencies when HMR is enabled, breaking self-referencing components. Fixes #59632. PR Close #59644
-
Kristiyan Kostadinov authored
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
-
Angular Robot authored
See associated pull request for more information. PR Close #59623
-
Kristiyan Kostadinov authored
Both `:host` and `:host-context` work by looking for a specific character sequence that is terminated by `,` or `{` and replacing selectors inside of it with scoped versions. This is implemented as a regex which isn't aware of things like nested selectors. Normally this is fine for `:host`, because each `:host` produces one scoped selector which doesn't affect any child selectors, however it breaks down with `:host-context` which replaces each instance with two selectors. For example, if we have a selector in the form of `:host-context(.foo) a:not(.a, .b)`, the compiler ends up determining that `.a,` is the end selector and produces `.foo[a-host] a[contenta]:not(.a, .foo [a-host] a[contenta]:not(.a, .b) {}`. These changes resolve the issue by splitting the CSS alogn top-level commas, processing the `:host-context` in them individually, and stiching the CSS back together. PR Close #59276
-
- Jan 21, 2025
-
-
Pawel Kozlowski authored
This change refactors the Angular-specific linkedSignal implementation such that its core logic can be shared with other frameworks. PR Close #59501
-
- Jan 20, 2025
-
-
Pawel Kozlowski authored
-
Kristiyan Kostadinov authored
When a component is created with shadow DOM encapsulation, we attach a shadow root to it. When the component is re-created during HMR, it was throwing an error because only one shadow root can be attached to a node at a time. Since there's no way to detach a shadow root from a node, these changes resolve the issue by making a shallow clone of the element, replacing it and using the clone for any future updates. Fixes #59588. PR Close #59597
-
Alan Agius authored
This change is required to resolve https://github.com/angular/angular-cli/pull/29248 and works in conjunction with https://github.com/angular/angular-cli/pull/29386. It ensures that HMR (Hot Module Replacement) functions correctly with `base href`, proxies, and other advanced development setups. PR Close #59620
-
Kristiyan Kostadinov authored
When HMR is enabled, we need to capture the dependencies used in a template and forward them to the HMR replacement function. One half of this process is static, meaning that we can't change it after the initial compilation. Tree shaking becomes a problem in such a case, because the user can change the template in a way that changes the set of dependencies which will start matching with the static part of the HMR code. These changes disable the tree shaking when HMR is enabled to ensure that the dependencies stay stable. Fixes #59581. PR Close #59595
-
Kristiyan Kostadinov authored
If a component injects `ViewContainerRef`, its `LView` gets wrapped in an empty `LContainer` and the container's host becomes the `LView`. The HMR logic wasn't accounting for this which meant that such components wouldn't be replaced. Fixes #59592. PR Close #59596
-
- Jan 18, 2025
-
-
Matt Janssen authored
Improves readability. PR Close #59568
-
arturovt authored
In this commit, we clean up the reference to the function set by the environment initializer, as the function closure may capture injected elements and prevent them from being properly garbage collected. PR Close #59598
-
Pawel Kozlowski authored
This change refactor how the dynamically created component deals with attributes in order to reuse the existing setupStaticAttributes logic (instead of having specific and similar code). PR Close #59572
-
- Jan 17, 2025
-
-
Andrew Kushnir authored
This commit updates a test setup to define a global `ngServerMode` correctly for a test that was emulating client-only behavior. The flag could've been set by prior tests and depending on its state, the test was acting differently. PR Close #59584
-
Andrew Kushnir authored
This commit updates testing setup logic to apply correct `document` reference, which should be used by the runtime. Previously, the timing of that operation was less predictable and in some cases led to reusing document state from previous tests. PR Close #59579
-
arturovt authored
In this commit, we delete `_ejsa` when the app is destroyed, ensuring that no elements are still captured in the global list and are not prevented from being garbage collected. PR Close #59492
-
arturovt authored
In this commit, we switch from decorators (which also produce redundant metadata, such as in the `declareFactory` instruction) to the `inject` function to drop the `ROUTER_FORROOT_GUARD` token in production. This token factory function is only in development mode but is still referenced in the constructor due to the `@Inject(ROUTER_FORROOT_GUARD)` decorator. PR Close #59458
-
Kristiyan Kostadinov authored
These changes aim to resolve the issue that prompted #59514. The animations module is a bit tricky for HMR, because it schedules the destruction of its renderer after the currently-running animations are done. If there are no running animations, the renderer gets destroyed next time around. This is a problem, because it means that the styles can stay around for a long time. These changes resolve the issue by: 1. Moving the cleanup of the renderer to after the destruction of the old view. This ensures that the usual clean up flow has been kicked off. 2. Flushing the animations when a component is replaced to ensure that the renderer is cleaned up in a timely manner. PR Close #59574
-
Angular Robot authored
See associated pull request for more information. PR Close #59571
-
Pawel Kozlowski authored
This refactoring takes a step toward breaking down the node_manipulation file into smaller, more focused files. PR Close #59462
-
Alex Rickabaugh authored
When the reactive `request` of a resource() notifies, it transitions to the Loading state, fires the loader, and eventually transitions to Resolved. With the prior implementation, a change of the `request` will queue the effect, but the state remains unchanged until the effect actually runs. For a brief period, the resource is in a state where the request has changed, but the state has yet to update. This is problematic if we want to use resources in certain contexts where we care about the state of the resource in a synchronous way. For example, an async validator backed by a resource might be checked after an update: ``` value.set(123); if (validator.value()) { // value is still valid, even though the resource is dirty and will soon // flip to loading state (returning value(): undefined) while revalidating } ``` To address this timing concern, `linkedSignal()` is used within the `resource()` to synchronously transition the state in response to the request changing. This ensures any followup reads see a consistent view of the resource regardless of whether the effect has run. This also addresses a race condition where `.set()` behaves differently on a `resource()` depending on whether or not the effect has run. PR Close #59024
-
Alex Rickabaugh authored
Originally the `T` in `Resource<T>` represented the resolved type of the resource, and `undefined` was explicitly added to this type in the `.value` signal. This turned out to be problematic, as it wasn't possible to write a type for a resource which didn't return `undefined` values. Such a type is useful for 2 reasons: 1. to support narrowing of the resource type when `Resource.hasValue()` returns `true`. 2. for resources which use a different value instead of `undefined` to represent not having a value (for example, array resources which want to use `[]` as their default). Instead, this commit changes `resource()` and `rxResource()` to return an explicit `ResourceRef<T|undefined>`, and removes the union with `undefined` from all types related to the resource's value. This way, it's trivially possible to write `Resource<T>` to represent resources where `.value` only returns `T`. `hasValue()` then actually works to perform narrowing, by narrowing the resource type to `Exclude<T, undefined>`. PR Close #59024
-
Leon Senft authored
Prevent leaking signal reads and exceptions from a custom `equal` function of a producer `computed()` to a consumer. Upstream https://github.com/tc39/proposal-signals/pull/90 with a notable change: Angular does **not** track reactive reads in custom `equal` implementations. PR Close #55818
-
Pawel Kozlowski authored
This commit updates the linkedSignal documentation around the quality function option. Fixes #59094 PR Close #59532
-
Matthieu Riegler authored
fixes #59538 PR Close #59539
-
- Jan 16, 2025
-
-
Pawel Kozlowski authored
-
Kristiyan Kostadinov authored
Fixes that in some cases the HMR replacement function was being run outside the zone which meant that change detection would break down after a replacement. Fixes #59559. PR Close #59562
-
Kristiyan Kostadinov authored
Rolls back the changes from #59514 because they ended up being breaking in 1P. We can revisit the internal fix in a different way. Fixes #59558. PR Close #59557
-
Pawel Kozlowski authored
The test in question was very flaky on CI, example run: https://github.com/angular/angular/actions/runs/12805645683/job/35702462974?pr=59557 Disabling as it is causing productivity loose for the team. PR Close #59561
-
Pawel Kozlowski authored
This is first of a series of refactorings that moves code around such that logic from the shared instruction file is dispatched to the relevant functional parts. PR Close #59453
-