angular/packages
Alex Rickabaugh bdd61c768a fix(core): replace assertion with more intentional error (#52234)
Issue #50320 shows that in some cases, updating a signal that's a dependency
of a template during change detection of that template can have several
adverse effects. This can happen, for example, if the signal is set during
the lifecycle hook of a directive within the same template that reads the
signal.

This can cause a few things to happen:

* Straightforwardly, it can cause `ExpressionChanged` errors.
* Surprisingly, it can cause an assertion within the `ReactiveLViewConsumer`
  to fail.
* Very surprisingly, it can cause change detection for an `OnPush` component
  to stop working.

The root cause of these later behaviors is subtle, and is ultimately a
desync between the reactive graph and the view tree's notion of "dirty" for
a given view. This will be fixed with further work planned for change
detection to handle such updates directly. Until then, this commit improves
the DX through two changes:

1. The mechanism of "committing" `ReactiveLViewConsumer`s to a view is
   changed to use the `consumerOnSignalRead` hook from the reactive graph.
   This prevents the situation which required the assertion in the first
   place.

2. A `console.warn` warning is added when a view is marked dirty via a
   signal while it's still executing.

The warning informs users that they're pushing data against the direction of
change detection, risking `ExpressionChanged` or other issues. It's a
warning and not an error because the check is overly broad and captures
situations where the application would not actually break as a result, such
as if a `computed` marked the template dirty but still returned the same
value.

PR Close #52234
2023-10-27 11:41:20 -07:00
..
animations refactor: fix a number of typos throughout the codebase (#52249) 2023-10-25 16:51:24 -07:00
bazel feat(bazel): make forbidOrphanComponents option configurable (#52061) 2023-10-10 15:30:26 -07:00
benchpress test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
common refactor(common): avoid repetitive globalThis in global locales (#52394) 2023-10-26 09:37:40 -07:00
compiler refactor(compiler): Don't double-create pipes in switch cases (#52289) 2023-10-24 11:07:50 -07:00
compiler-cli refactor: fix a number of typos throughout the codebase (#52249) 2023-10-25 16:51:24 -07:00
core fix(core): replace assertion with more intentional error (#52234) 2023-10-27 11:41:20 -07:00
docs/di docs: remove outdated/unsupported webworker doc (#49856) 2023-04-17 14:01:41 +00:00
elements build: add targets for api doc generation (#52034) 2023-10-10 16:18:50 -07:00
examples docs(forms): replace fb with formBuilder (#52261) 2023-10-19 09:24:39 -07:00
forms test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
language-service fix(language-service): Autocomplete block keywords in more cases (#52198) 2023-10-23 12:01:52 -07:00
localize build: update babel dependencies to v7.23.2 (#52236) 2023-10-17 18:11:09 +02:00
misc/angular-in-memory-web-api docs: update invalid links to the new http guides (#49456) 2023-06-22 17:06:59 -07:00
platform-browser docs: update SSR doc to reflect version 17 (#52398) 2023-10-26 12:30:59 -07:00
platform-browser-dynamic test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
platform-server docs: update SSR doc to reflect version 17 (#52398) 2023-10-26 12:30:59 -07:00
private/testing fix(platform-server): bundle @angular/domino in via esbuild (#49229) 2023-02-28 13:34:50 -08:00
router docs: update SSR doc to reflect version 17 (#52398) 2023-10-26 12:30:59 -07:00
service-worker test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
upgrade refactor: fix a number of typos throughout the codebase (#52249) 2023-10-25 16:51:24 -07:00
zone.js build: update cross-repo angular dependencies (#52191) 2023-10-26 14:12:34 -07:00
BUILD.bazel build(bazel): list docs entrypoints under packages to simplify docgen 2022-11-22 13:51:16 -07:00
circular-deps-test.conf.js build: ignore type only imports/exports for circular dependency checks (#47017) 2022-08-18 12:06:09 -07:00
empty.ts
goog.d.ts
license-banner.txt build: bump license year (#44590) 2022-01-04 12:05:25 -08:00
README.md
system.d.ts
tsconfig-build.json build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
tsconfig-legacy-saucelabs.json refactor(compiler): drop obsolete NgFactory and NgSummary config options (#48268) 2023-02-21 13:03:59 -08:00
tsconfig-test.json build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
tsconfig-tsec-base.json refactor(core): throw an error when hydration marker is missing from DOM (#51170) 2023-08-04 11:31:49 -04:00
tsconfig.json build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
tsec-exemption.json fix(core): hardening attribute and property binding rules for <iframe> elements (#47964) 2022-11-09 00:47:56 -08:00
types.d.ts build: update to jasmine 4.0 (#45558) 2022-04-11 16:25:28 +00:00

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

Usage information and reference details can be found in Angular documentation.

License: MIT