angular-docs-cn/packages
JiaLiPassion 0652b29f62 fix(zone.js): setTimeout patch should clean tasksByHandleId cache. (#40586)
Close #40387

Currently zone.js patches `setTimeout` and keeps a `tasksByHandleId` map to keep `timerId` <-> `ZoneTask`
relationship. This is needed so that when `clearTimeout(timerId)` is called, zone.js can find the associated
`ZoneTask`. Now zone.js set the `tasksByHandleId` map in the `scheduleTask` function, but if the `setTimeout`
is running in the `FakeAsyncZoneSpec` or any other `ZoneSpec` with `onScheduleTask` hooks. The `scheduleTask`
in `timer` patch may not be invoked.

For example:

```
fakeAsync(() => {
  setTimeout(() => {});
  tick();
});
```

In this case, the `timerId` kept in the `tasksByHandleId` map is not cleared.
This is because the `FakeAsyncZoneSpec` in the `onScheduleTask` hook looks like this.

```
onScheduleTask(delegate, ..., task) {
  fakeAsyncScheduler.setTimeout(task);
  return task;
}
```

Because `FakeAsyncZoneSpec` handles the task itself and it doesn't call `parentDelegate.onScheduleTask`,
therefore the default `scheduleTask` in the `timer` patch is not invoked.

In this commit, the cleanup logic is moved from `scheduleTask` to `setTimeout` patch entry to
avoid the memory leak.

PR Close #40586
2021-02-09 10:43:05 -08:00
..
animations refactor(animations): remove unused utils function (#40588) 2021-01-28 09:01:07 -08:00
bazel build: update bazel rules_nodejs to 2.3.3 (#40581) 2021-01-26 15:07:04 -08:00
benchpress build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -08:00
common fix(core): ensure the type `T` of `EventEmitter<T>` can be inferred (#40644) 2021-02-03 09:07:29 -08:00
compiler fix(compiler-cli): preserve user line endings in diagnostic template parse (#40597) 2021-01-29 11:15:16 -08:00
compiler-cli fix(core): ensure the type `T` of `EventEmitter<T>` can be inferred (#40644) 2021-02-03 09:07:29 -08:00
core fix(core): ensure the type `T` of `EventEmitter<T>` can be inferred (#40644) 2021-02-03 09:07:29 -08:00
docs docs(di): fix typo in advanced di doc (#36634) 2020-05-01 09:50:28 -07:00
elements fix(elements): update the view of an `OnPush` component when inputs change (#39452) 2020-11-06 09:31:46 -08:00
examples docs: remove unused "docregions" (#40479) 2021-01-20 16:12:15 -08:00
forms feat(forms): introduce min and max validators (#39063) 2021-02-08 09:34:50 -08:00
language-service feat(language-service): add command for getting components for a template file (#40655) 2021-02-04 10:47:22 -08:00
localize fix(localize): include meaning in generated ARB files (#40546) 2021-01-25 11:02:18 -08:00
misc/angular-in-memory-web-api docs: remove duplicated the (#40434) 2021-01-14 11:33:57 -08:00
platform-browser fix(animations): implement getPosition in browser animation builder (#39983) 2020-12-08 16:24:41 -08:00
platform-browser-dynamic docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
platform-server build: support building with TypeScript 4.1 (#39571) 2020-11-25 11:10:01 -08:00
private/testing build: update .bazelversion (#40579) 2021-01-26 11:35:54 -08:00
router fix(router): stop emitting to event observable on destroy (#40638) 2021-02-04 10:46:46 -08:00
service-worker fix(service-worker): handle error with console.error (#40236) 2021-01-25 10:11:58 -08:00
upgrade fix(upgrade): fix HMR for hybrid applications (#40045) 2020-12-10 13:40:53 -08:00
zone.js fix(zone.js): setTimeout patch should clean tasksByHandleId cache. (#40586) 2021-02-09 10:43:05 -08:00
BUILD.bazel build: replace @types/trusted-types dep with minimal type defs (#39211) 2020-10-15 09:08:00 -07:00
README.md docs: add doc reference to npm package readme (#33911) 2019-11-20 14:46:23 -08:00
circular-deps-test.conf.js fix(platform-webworker): remove platform-webworker and platform-webworker-dynamic (#38846) 2020-09-30 09:13:59 -04:00
empty.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
goog.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
license-banner.txt build: bump year (#34651) 2020-01-13 07:21:43 -08:00
system.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
tsconfig-build-no-strict.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-build.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig.json fix(platform-webworker): remove platform-webworker and platform-webworker-dynamic (#38846) 2020-09-30 09:13:59 -04:00
types.d.ts build: replace @types/trusted-types dep with minimal type defs (#39211) 2020-10-15 09:08:00 -07:00

README.md

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