angular/packages
Pawel Kozlowski c7ff9dff2c fix(core): drop mutate function from the signals public API (#51821)
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
2023-10-05 14:40:50 -07:00
..
animations test(animations): update the integration test (#50738) 2023-09-29 10:49:41 -07:00
bazel feat(core): enable block syntax (#51994) 2023-10-03 15:26:05 -07:00
benchpress feat(benchpress): report gc and render time spent in script (#50771) 2023-10-05 10:52:26 -07:00
common feat(common): upgrade warning to logged error for lazy-loaded LCP images using NgOptimizedImage (#52004) 2023-10-04 11:36:01 -07:00
compiler refactor(language-service): Prepare to support blocks in the langauge service (#52038) 2023-10-05 14:35:00 -07:00
compiler-cli refactor(compiler): introduce unknown block node (#52047) 2023-10-05 13:10:05 -07:00
core fix(core): drop mutate function from the signals public API (#51821) 2023-10-05 14:40:50 -07:00
docs/di docs: remove outdated/unsupported webworker doc (#49856) 2023-04-17 14:01:41 +00:00
elements build: remove support for Node.js v16 (#51755) 2023-09-13 10:49:06 -07:00
examples build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
forms refactor(forms): Use the Writable type when overwriting readonly properties. (#49754) 2023-09-22 10:02:13 -07:00
language-service refactor(language-service): Prepare to support blocks in the langauge service (#52038) 2023-10-05 14:35:00 -07:00
localize feat(core): implement new block syntax (#51891) 2023-09-26 09:10:04 -07: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 fix(platform-browser): prevent duplicate stylesheets from being created (#52019) 2023-10-05 14:06:56 -07:00
platform-browser-dynamic build: remove support for Node.js v16 (#51755) 2023-09-13 10:49:06 -07:00
platform-server feat(core): enable block syntax (#51994) 2023-10-03 15:26:05 -07:00
private/testing fix(platform-server): bundle @angular/domino in via esbuild (#49229) 2023-02-28 13:34:50 -08:00
router refactor(router): move location methods into state_manager.ts (#52032) 2023-10-05 11:02:07 -07:00
service-worker fix(service-worker): throw a critical error when handleFetch fails (#51960) 2023-10-04 08:50:50 -07:00
upgrade build: remove support for Node.js v16 (#51755) 2023-09-13 10:49:06 -07:00
zone.js build: lock file maintenance (#51834) 2023-10-04 11:31:27 -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 refactor(core): replace references to goog.LOCALE with goog.getLocale() (#43089) 2021-08-10 10:35:26 -07:00
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