forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a new pull request by comparing changes across two branches #132
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update to the latest version of material PR Close #51996
Adds some logic to enable parsing of block syntax in the linker. Note that the syntax is only enabled on code compiled with Angular v17 or later. PR Close #51979
…and `ConsumesSlotOpTrait` (#51942) Ops with `ConsumesSlotOpTrait` have a self-xref, and are assigned a corresponding `slot`. Ops with `UsesSlotIndexTrait` have a `target`-xref, and are assigned the `slot` of that `target`. In both cases, the field name `slot` is used, but it means different things. Therefore, any op which both consumes and uses a slot will have a collision of two different meanings on its `slot` field. This commit renames `slot` to `slotTarget` in the `UsesSlotIndexTrait`, to eliminate this collision. PR Close #51942
The new list reconcilation algorithm, an alternative to the DefaultIterableListDiffer. It works by performing updates in place instead of creating intermediate data describing changes to apply. For lists expressed as an Array it performs additional optimizations for the moves and swap scenarios. The new list diffing approach is meant to be used in the new control flow and should me much faster as compared to the ngFor with the DefaultIterableListDiffer. PR Close #51980
) Reworks a few more places to output arrow functions instead of function declarations in order to reduce the amount of code we generate. Some of these places include: * Factories in injectable definitions. * Forward references. * `dependencies` function in the component definition. * `consts` function in the component definition. PR Close #52010
See associated pull request for more information. PR Close #51983
Adds `noPropertyAccessFromIndexSignature` to the tsconfig of the schematics in order to align it with the rest of the project. PR Close #51969
) Adds a benchmark for potential upcoming `NgTemplateOutlet` context logic updates. PR Close #51887
We are including a file, for some reason, that is outside of the root dir. This breaks TypeScript/ or more specifically VSCode from picking up this tsconfig- breaking path mappings and hence auto completion. PR Close #51887
… in `EmbeddedViewRef` (#51887) This partially reverts commit a3e1719 and deprecates behavior added. The context of an embedded view ref at some point was switched from a getter to an actual assignable property. This is something we revert as it introduces additional complexity for our generated code (in terms of closures capturing the `ctx`), creates technical limitations for Angular's internals and the usage pattern is rarely used (and can be addressed via simple assignments, `Object.assign` or the use of a proxy if replacing the full context object is still desirable) DEPRECATED: Swapping out the context object for `EmbeddedViewRef` is no longer supported. Support for this was introduced with v12.0.0, but this pattern is rarely used. There is no replacement, but you can use simple assignments in most cases, or `Object.assign , or alternatively still replace the full object by using a `Proxy` (see `NgTemplateOutlet` as an example). Also adds a warning if the deprecated PR Close #51887
…ext swapping (#51887) The context of an embedded view ref at some point was switched from a getter to an actual assignable property. This is something we reverted with the previous commit as it introduces additional complexity for our generated code (in terms of closures capturing the `ctx`). This change impacted the template outlet code because we actively relied on swapping out the full context if the user changes it. Previousl, before we allowed to swap out the context (in v16), we mutated the initial view context if it didn't change structurally- and in other cases the view was re-created. We improved this performance aspect with the changes to allow for the context to be swapped out + actually also fixed a bug where the initial context object was mutated and the user could observe this change. This commit adjusts for context not being replacable- while still keeping the bugs fixed and preserving the performance wins of not having to destroy/re-create the view whenever the context changes. Benchmarks: https://hackmd.io/J0Ci_JzxQ0K1AA1omXhIQQ PR Close #51887
…1952) Currently the TCB for aliased `if` blocks looks something like this: ``` // Markup: `@if (expr; as alias) { {{alias}} } if (block.condition) { var alias = block.condition; "" + alias; } ``` The problem with this approach is that the type of `alias` won't be narrowed. This is something that `NgIf` currently supports. These changes resolve the issue by emitting the variable outside the `if` block and using the variable reference instead: ``` // Markup: `@if (expr; as alias) { {{alias}} } var alias = block.condition; if (alias) { "" + alias; } ``` PR Close #51952
…51960) #51885 patched a call site that threw an error but there were 2 others call that needed to be wrapped in the same way by a try/catch. `initializeFully` is part of the calls in `responseWith(handleFetch)`. Same #51885, throwing `SwCriticalError`allows the driver to fallback to `safeFetch` and ensure `responseWith` doesn't fail. Fixes #50378 PR Close #51960
…ncy (#51964) Currently, if there are 2 nested @defer blocks with the same dependency, Angular throws an error at runtime to indicate that there was a duplicate component def in the registry. This commit updates the logic to only append dependencies when they didn't previously exist in the registry. PR Close #51964
…d in the wrong places (#51950) Previously, we always generated temporary variable declarations at the beginning of each view's update block. This is wrong, for two reasons: 1. Temporaries can be used in the create block 2. When listeners use temporaries, we should declare them inside the listener. Now, we always place temporaries at the beginning of the enclosing OpList, and recursively try to generate them when we find a listener. PR Close #51950
…indings (#51950) For components, the parser already extracts the `important` property (and it is later disregarded). However, because host bindings use a totally separate parsing code path, this was never happing for host bindings. Here, we add some code to the host style parsing phase to drop the `!important` suffix. We could solve this category of problems for good by parsing host bindings with the same code as template bindings. PR Close #51950
#51950) Consider an `ng-template` which is generated as a result of a structural directive: ``` <div *ngFor="let inner of items" (click)="onClick(inner)" [title]="getTitle()" > ``` This should logically expand into something like the following: ``` <ng-template [ngForOf]="..." > <div (click)="..." [title]="..."></div> </ng-template> ``` Note that the `(click)` handler and the `[title]` property are only present on the inner div, *not* on the enclosing generated `ng-template`. Previously, Template Pipeline would place these bindings on *both* the tempate and the inner element. However, we can't just remove them completely, because these bindings should still be matchable on the generated `ng-template` (which is very surprising, but nonetheless true). We resolve this issue with two improvements: (1) The ingestion step is now much smarter about determining not only if a binding is on a template element, but whether it actually targets that template element. (2) We use `ExtractedAttributeOp` directly, rather than going through `BindingOp`, to cause the `ng-template` to still receive these bindings in its `consts` array for matching purposes. PR Close #51950
…ne tests (#51950) A couple tests were already passing, and just needed to be enabled. This includes tests pertaining to: * ng-template * host binding styling slots * and host animation bindings * some literal tests (which were missing some $foo$ escaped names) We add pipeline-specific versions of the following tests, and enable them: * A local refs test. The consts for the element attributes and the consts for local reference are collected in the reverse order, but the emitted template is functionally the same. * A safe accesstest. Consider the expression `$any(val)?.foo`. `TemplateDefinitionBuilder` extracts a temporary variable: `($tmp_0_0$ = $ctx$.val) == null ? null : $tmp_0_0$.foo`. It presumably does this because it considers the `$any(...)` to be a function call. However, this is not a real call, so Template Pipeline safely ignores it and declines to generate a temporary. * Another local refs test. AttributeMarker.Template is emitted at the end of the const array (instead of the middle) PR Close #51950
…ct` reloads (#51912) When the `ts.Project` creates the language service plugin (in this case, the Angular Language Service), it sets the project's language service to the new language service returned by the plugin create: https://sourcegraph.com/github.com/microsoft/TypeScript@b12af0fa2bbd4b015e59adcfb49988cea7f919a1/-/blob/src/server/project.ts?L2035-2044 The project may be reloaded in response to various events, such as a change to the tsconfig file, which then recreates the plugin. When this happens, the language service that gets passed to the plugin `create` function will not be the typescript language service, but rather the previous instance of the new language service returned by the last call to `create`. This commit ensures that subsequent calls to `create` for the `NgLanguageService` plugin for a project after the first call are able to retrieve and hold on to the _TypeScript_ language service. fixes angular/vscode-ng-language-service#1923 PR Close #51912
Update the lock file. PR Close #51834
This adds API doc extraction for interfaces, largely using the same code paths for classes. The primary difference between classes and interfaces is that classes have member _declarations_ while interfaces have member _signatures_. This largely doesn't matter for the purposes of extraction, but the types are distinct with no common base types, so we have to do a fair amount of type unioning and aliasing. PR Close #52006
Use Github Actions to run saucelabs bazel jobs PR Close #51945
GC and render events can happen _while_ running scripts as well as outside of the script blocks. The new metric entries capture both the gc and render time happening in the scrip blocks. PR Close #50771
Migrate the snapshot publishing from CircleCI to GHA PR Close #51957
Updated Angular CLI help contents. PR Close #52022
This is a preparatory refactor to enable a new version of state_manager.ts that uses the Navigation API rather than History API PR Close #52032
Revert (with improvements of): dcf18dc We recently landed a change that allows `toSignal` to be called from within reactive contexts (e.g. `effect`/`computed`). After more thorough investigatio and consideration with the team, we feel like allowing `toSignal` to be called in such contexts is encouraging non-ideal / hard-to-notice code patterns. e.g. a new subscription to an observable is made every time `toSignal` is invoked. There is no caching done here. Additionally, multiple new subscriptions can trigger unintended side-effects- that may slow down the app, result in incorrect/unexpected behavior or perform unnecessary work. Users should instead move the `toSignal` call outside of the `computed` or `effect` and then read the signal values from within their `computed`. e.g. ```ts computed(() => { const smth = toSignal(coldObservable$) return smth() + 2; } ``` --> should instead be: ```ts const smth = toSignal(coldObsverable$); computed(() => smth() + 2); ``` In cases where a new subscription for each invocation is actually intended, a manual subscription can be made. That way it's also much more obvious to users that they are triggering side-effects every time, or causing new subscriptions. PR Close #52049
Updates the lexer to parse blocks as incomplete, instead of throwing errors. This will allow us to better handle them further down in the pipeline. PR Close #52047
Adds some logic to treat incomplete blocks as empty blocks so that we can recover from them. Also logs an error about the incomplete block. PR Close #52047
Adds an `UnknownBlock` node to the Ivy AST to represent blocks that haven't been recognized by the compiler. This will make it easier to integrate blocks into the language service. PR Close #52047
See associated pull request for more information. PR Close #51992
… service (#52038) Two key refactors to enable deeper language service support for blocks: (1) We now generate accurate source spans for the various block types. Additionally, all the top-level source spans for a block are now *inclusive* of all the connected or descending blocks. This helps the language service visit connected blocks. (2) The language service's template visitor was previously skipping over the AST nodes corresponding to several block types. We are now careful to visit all such nodes. PR Close #52038
This change removes the `mutate` method from the `WritableSignal` interface and completely drops it from the public API surface. The initial API proposal for Angular signals included the mutate method, allowing in-place modification of JS objects, without changing their references (identity). This was based on the reasoning that identity change on modification is not necessary as we can send the “modified” notification through the signals graph. Unfortunately the signal-specific change notification is lost as soon as we read signal value outside of a reactive context (outside of a reactive graph). In other words - any code outside of the Angular signals library can’t know that an object is modified. Secondly, to make the mutate method work, we’ve defaulted the signal value equality function to the one that considers non-primitive values as always different. This is unfortunate for people working with immutable data structures (this is notably the case for the popular state management libraries) as the default equality function de-optimizes memoization in computed, making the application less performant. Given the above reasons we prefer to remove the mutate method in the signals library - at least for now. There are just too many sharp edges and tradeoffs that we don’t fully understand yet. BREAKING CHANGE: The `mutate` method was removed from the `WritableSignal` interface and completely dropped from the public API surface. As an alternative please use the update method and make immutable changes to the object. Example before: ```typescript items.mutate(itemsArray => itemsArray.push(newItem)); ``` Example after: ```typescript items.update(itemsArray => [itemsArray, …newItem]); ``` PR Close #51821
This change marks core signal APIs as stable and exit developer preview for the main signal building blocks. PR Close #51821
Moves each control flow test (if, switch, for) into their corresponding file. PR Close #52045
Add some more tests around list diffing (created in a different branch while working in the list diffing). PR Close #52045
GulajavaMinistudio
merged commit Oct 6, 2023
33a19d1
into
angular-indonesia:main
1 of 9 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information