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 #180
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
This commits converts the hand-written tests into their usual, compiled form. We can perform this change now since the compiler bits of the queries-as-signal story landed. PR Close #54103
This commit adds tests for content queries and fixes the arguments order in the contentQuerySignal instruction, thus fixing a bug discovered while adding tests. PR Close #54103
…ues (#54103) This commit changes the approach to the reactive node representing query results: instead of creating a custom node type we can use a computed - the main change to get there is representing dirty change notification as a signal (a counter updated every time a query changes its dirty status). This change is dictated by simplification (we can avoid creation of a custom signal type) as well as fixes to the multiple issues not covered by the initial implementation: - assuring referential stability of results (ex.: the same array instance returned from child queries until results change); - per-view results collection to avoid a situation where accessing query results during view creation would return partial / inconsistent results; - proper refresh of query results for both live and non-connected consumers. All the above cases are covered by the additional tests in this commit. PR Close #54103
This commit introduces a dedicated error code for queries that require results but none are available. PR Close #54103
…54103) The compileNgModuleFactory dont need to be in the application_ref file (in fact the whole logic has little to do with ApplicationRef and it is not even called from the application_ref). Performing this move to avoid circular dependencies when the new query as signals authoring functions are exported. PR Close #54103
Adding debug information for failing firebase deploy, hoping to yield information about the missing resource. The next multi-site seems to be failing, but is available. PR Close #54275
…54257) This commit adds a JIT transform for signal-based queries, so that queries are working as expected in JIT environments like `ng test` where decorator metadata is needed as a prerequisite for the component definition creation. This is similar to the JIT transforms for signal inputs etc. PR Close #54257
…d queries (#54257) The `read` option for queries can rely on lexical variables inside the class. These constructs are fine from a technical perspective in TypeScript, but in practice, when the component/directive definition is being created, the read value is extracted into the definition, **outside** of the class. This breaks `this` references. To fix this, we are restricting the `read` option to literal values. Similar to `descendants`. Literal references are in practice constructs like: - `read: bla.X` - `read: X` where `bla` or `X` is never a `ThisKeywoord`- hence fixing the issue and also simplifying the patterns for easier single file compilation. PR Close #54257
…lly (#54273) Currently, when two components are named `TestComponent`, and both would use e.g. control flow. Templates would be generated by the compiler and those would conflict at runtime because the names for the template functions are not ensured to be unique. This seems like a more general problem that could be tackled in the future in the template pipeline by always using the `ConstantPool`, but for now, we should be good already, given us ensuring the `baseName`'s are always unique. PR Close #54273
Update to the latest version of angular docs from dev-infra PR Close #54282
Updated Angular CLI help contents. PR Close #54276
See associated pull request for more information. PR Close #53220
See associated pull request for more information. PR Close #53222
See associated pull request for more information. PR Close #54202
See associated pull request for more information. PR Close #54234
See associated pull request for more information. PR Close #53554
Update typing to show that a number is being used as index rather than any random string PR Close #54286
See associated pull request for more information. PR Close #54290
See associated pull request for more information. PR Close #54288
This commit exposes authoring functions for queries as signals thus making those generally available. PR Close #54283
Use signal queries tests with the authoring functions and without decorators. PR Close #54283
See associated pull request for more information. PR Close #54289
…LATION_UNRESOLVED_CONST when an unresolved symbol used for @component.styles (#54230) Currently the correct error message is shown only if @component.styles is an array with some unresolved element. This change supports the new case of string type for the @component.styles field. PR Close #54230
husky v9 simplified its setup, see `How to migrate` in https://github.com/typicode/husky/releases/tag/v9.0.1 PR Close #54315
…eries (#54280) This commit improves IDE completion of the `read` option for signal-based queries. Currently, TS only matches the first overload when starting out with defining a query. TS doesn't build up the combination of possible options from the second overload- so in practice users will only see IDE completions for the `descendants` option. This is not a problem for view queries as the only option is `read`, so TS will always match the overload with the `read` option. ``` class X { query = contentChild('', {^^ <-- here we should completion for `read` an `descendants` } ``` PR Close #54280
Adds the implementation of the `model` primitive that represents a two-way binding signal-based binding. PR Close #54252
Adds a function to the compiler to help us identify fields initialized to a `model`. PR Close #54252
Adds a JIT transform that marks `model` fields as `@Input` and `@Output`. PR Close #54252
Adds the implementations of the `twoWayProperty` and `twoWayListener` instructions. PR Close #54252
Adds the logic that recognizes fields initialized to model as an input/output pair. PR Close #54252
Sets up the runtime tests for model inputs. PR Close #54252
Adds tests in the compiler to verify the compiled output and template type checking behavior of model inputs. PR Close #54252
Adds support for model inputs in the framework. `model()` returns a writable signal that implicitly defines a input/output pair that can be used either in two-way bindings to keep two values in sync or by binding individually to the input and output. When the value of the `model` changes, it will emit an event with the current value. Furthermore, these changes expand two-way bindings to accept `WritableSignal`. This will make it easier to transition existing code to signals in a backwards-compatible way. Example: ```ts @directive({ selector: 'counter', standalone: true, host: { '(click)': 'increment()', } }) export class Counter { value = model(0); increment(): void { this.value.update(current => current + 1); } } @component({ template: `<counter [(value)]="count"/> The current count is: {{count()}}`, }) class App { count = signal(0); } ``` PR Close #54252
Reworks the TCB for two-way bindings to make them simpler and to avoid regressions for two-way bindings to generic inputs. The new TCB looks as follows: ``` var _t1: Dir; var _t2 = _t1.input; (_t1 as typeof _t2 | WritableSignal<typeof _t2>) = expression; ``` PR Close #54252
…with different getter/setter types (#54252) In a previous commit the TCB was changed to cast the assignment to an input in order to widen its type to allow `WritableSignal`. This ended up breaking existing inputs whose setter has a wider type than its getter. These changes switch to unwrapping the value on the binding side. PR Close #54252
…54309) An identical addition to: 760b1f3. This commit expands the `try/catch`-es: - to properly NOT throw and just convert the diagnostic. - to be in place for all top-level instances. Notably, this logic cannot reside in the template type checker directly as otherwise we would risk multiple duplicate diagnostics. PR Close #54309
…#54309) This helps with the Angular CLI currently swallowing fatal diagnostic errors in ways that are extremely difficult to debug due to workers executing Angular compiler logic. The worker logic, via piscina, is currently not forwarding such Angular errors because those don't extend `Error.` https://github.com/piscinajs/piscina/blob/a7042ea27d129f3cad75c422f5aa92f0663854ee/src/worker.ts#L175 Even with access to these errors by manually forwarding errors, via patching of the Angular CLI, there is no stack trace due to us not using `Error` as base class for fatal diagnostic errors. This commit improves this for future debugging and also better reporting of such errors to our users- if we would accidentally leak one. PR Close #54309
Adds usages of signal-based queries into the signal integration test to verify queries can be used in production, and testing environments as expected (i.e. the transform works as expected). PR Close #54314
Introducing a tiny utility method to remove some code duplication between the change change detection and signal based queries. PR Close #54322
GulajavaMinistudio
merged commit Feb 8, 2024
c8fb45d
into
angular-indonesia:main
7 of 15 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