Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/angular/angular.git. Pull mirroring updated .
  1. Oct 27, 2023
  2. Oct 26, 2023
  3. Oct 25, 2023
    • Andrew Scott's avatar
      fix(core): Ensure backwards-referenced transplanted views are refreshed (#51854) · 76152a5f
      Andrew Scott authored
      This commit runs change detection in a loop while there are still dirty
      views to be refreshed in the tree. At the moment, this only applies to
      transplanted views but will also apply to views with changed signals.
      
      fixes angular#49801
      
      PR Close #51854
      76152a5f
    • Kristiyan Kostadinov's avatar
      fix(migrations): handle nested classes in control flow migration (#52309) · c993e9a4
      Kristiyan Kostadinov authored
      Fixes that the control flow migration was only processing top-level classes. Nested classes could come up during unit tests.
      
      PR Close #52309
      c993e9a4
    • Kristiyan Kostadinov's avatar
      fix(migrations): handle nested classes in block entities migration (#52309) · 9e764689
      Kristiyan Kostadinov authored
      Fixes that the block entities migration was only processing top-level classes. Nested classes could come up during unit tests.
      
      PR Close #52309
      9e764689
    • Alan Agius's avatar
      perf(http): reduce data transfer when using HTTP caching (#52347) · c5e30f1d
      Alan Agius authored
      This commit reduces the property size in the http transfer cache to reduce the page payload.
      
      Before
      ```html
      <script id="ng-state" type="application/json">
      {
        "4155228514": {
          "body": "....",
          "headers": {},
          "status": 200,
          "statusText": "OK",
          "url": "http://foo.com/assets/media.json",
          "responseType": "json"
        },
      }
      </script>
      ```
      
      Now
      ```html
      <script id="ng-state" type="application/json">
      {
        "4155228514": {
          "b": "....",
          "h": {},
          "s": 200,
          "st": "OK",
          "u": "http://foo.com/assets/media.json",
          "rt": "json"
        },
      }
      </script>
      ```
      
      PR Close #52347
      c5e30f1d
    • Joey Perrott's avatar
      build: lock file maintenance (#52353) · 5436890d
      Joey Perrott authored
      See associated pull request for more information.
      
      PR Close #52353
      5436890d
    • Jessica Janiuk's avatar
      fix(migrations): Fixes the root level template offset in control flow migration (#52355) · 90eb8797
      Jessica Janiuk authored
      When migrating an ng-template later on in a file, the migrationResult was not being reset to zero and causing offsets to be double applied due to ng-template nodes being included in the migration loop.
      
      PR Close #52355
      90eb8797
    • Dylan Hunn's avatar
      refactor(compiler): Don't double-create pipes in switch cases (#52289) · d82d5862
      Dylan Hunn authored
      Previously, we would emit *two* pipe creation instructions for each pipe in a switch case. This is because we were visiting both the transformed and raw versions of the pipe bindings.
      
      Now, we clear the raw case expressions array after generating the transformed test expression.
      
      Also, we introduce some new goldens, because our pipe creation order is harmlessly different.
      
      PR Close #52289
      d82d5862
    • Dylan Hunn's avatar
      refactor(compiler): Support content projection source maps (#52289) · 17be1a8a
      Dylan Hunn authored
      The `projection` op should map onto the entire corresponding `ng-content`.
      
      PR Close #52289
      17be1a8a
    • Dylan Hunn's avatar
      refactor(compiler): Update pipe test golden for alternative create order (#52289) · 3343ceb8
      Dylan Hunn authored
      We roughly attempt to match TemplateDefinitionBuilder's pipe creation order, by placing pipe creation instructions after their target elements. However, we cannot fully emulate the "inside-out" ordering TemplateDefinitionBuilder uses when multiple pipes apply to one element, because TemplateDefinitionBuilder creates the pipes as expressions are visited, from the leaves up. Our order is perfectly adequate though.
      
      We also add a non-compatibility-mode ordering, which just appends them to the end of the create block. This is better because it allows for more chaining opportunities.
      
      PR Close #52289
      3343ceb8
    • Dylan Hunn's avatar
      refactor(compiler): Fix a special case involving var counting for singleton... · 0491fba5
      Dylan Hunn authored
      refactor(compiler): Fix a special case involving var counting for singleton `propertyInterpolate` (#52289)
      
      Singleton property interpolation instructions consume only one variable, but are still emitted as an interpolation instruction (they cannot be collapsed because `propertyInterpolate` implicitly stringifies its argument.)
      
      PR Close #52289
      0491fba5
    • Dylan Hunn's avatar
      refactor(compiler): The projection instruction takes an array literal (#52289) · f6cc09b0
      Dylan Hunn authored
      We were incorrectly emiting a extracted constant pool index for the final argument of the projection instruction. It actually takes an array literal.
      
      (N.B.: This means we re-create the array every time! We should probably modify the runtime to use a const index for this.)
      
      Additionally, we alter the projection op to not extend the element op base type.
      
      PR Close #52289
      f6cc09b0
    • Dylan Hunn's avatar
      refactor(compiler): Improve the ordering of update ops (#52289) · 9f839272
      Dylan Hunn authored
      The correct order of attributes and properties is:
      
      1. Interpolated properties
      2. Interpolated attributes
      3. Non-interpolated properties
      4. Non-interpolated attributes
      
      This includes an additional nuance: singleton attribute interpolations, such as `[attr.foo]="{{bar}}"`, will be "collaped" into a simple `attribute` instruction. However, this is *not* the case for singleton property interpolations! The ordering phase must take this nuance into account to match the TemplateDefinitionBuilder order.
      
      After the project lands, it might be nice to also collapse singleton property interpolations.
      
      PR Close #52289
      9f839272
    • Dylan Hunn's avatar
      refactor(compiler): Order elements before other phases (#52289) · d55ff744
      Dylan Hunn authored
      Previously, we ran the ordering phase near the end of the compilation. However, this meant that phases like slot assignment and variable offset assignment would happen first, and then the nice, monotonically-increasing orders would be scrambled by the reordering.
      
      It's much more intelligible to order first, and then perform these assignments. However, to make this happen, some modifications to the ordering phase are required. In particular, we can no longer rely on `advance` instructions to break up orderable groups.
      
      PR Close #52289
      d55ff744
    • Dylan Hunn's avatar
      refactor(compiler): Imitate TemplateDefinitionBuilder's variable offset assignment order (#52289) · b814b97d
      Dylan Hunn authored
      Many instructions consume variable slots, which are used to persist data between update runs. For top-level instructions, the offset into the variable data array is implicitly advanced, because those instructions always run.
      
      However, instructions in non-top-level expressions cannot be assumed to run every time, because they might be conditionally executed. Therefore, they cannot implicitly advance the offset into the variable data, and must be given an explicitly assigned variable offset.
      
      TemplateDefinitionBuilder assigned offsets top-to-bottom for all instructions *except* pure functions. Pure functions would be assigned offsets lazily, on a second pass.
      
      Template Pipeline can now imitate this behavior, when in compatibility mode: pure functions are assigned offsets on a second pass.
      
      This also makes the "variadic var offsets" phase unnecessary -- the new approach is more general and correct.
      
      PR Close #52289
      b814b97d
    • Dylan Hunn's avatar
      refactor(compiler): Use already available context in closures, instead of saving it (#52289) · 044df0c1
      Dylan Hunn authored
      Previously, inside an event listener, template pipeline would always save the context from restoring a view, e.g.
      
      ```
      const restored_ctx = r0.ɵɵrestoreView(s);
      ```
      
      This is usually correct! However, consider the case of a listener in the template's root view. The appropriate context will already be available via closure capture, and we can just use it (as `ctx`).
      
      Now, the context resolution phase understands that we don't need to use the restored view's saved context if we would have access to it by closure.
      
      Note: we also create a new golden, because the const array is in a harmlessly different order.
      
      PR Close #52289
      044df0c1