mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
One downside of implicit dependency tracking in `effect()`s is that it's easy to for downstream code to end up running inside the effect context by accident. For example, if an effect raises an event (e.g. by `next()`ing a `Subject`), the subscribers to that `Observable` will run inside the effect's reactive context, and any signals read within the subscriber will end up as dependencies of the effect. This is why the `untracked` function is useful, to run certain operations without incidental signal reads ending up tracked. However, knowing when this is necessary is non-trivial. For example, injecting a dependency might cause it to be instantiated, which would run the constructor in the effect context unless the injection operation is untracked. Therefore, Angular will automatically drop the reactive context within a number of framework APIs. This commit addresses these use cases: * creating and destroying views * creating and destroying DI injectors * injecting dependencies * emitting outputs Fixes #54548 There are likely other APIs which would benefit from this approach, but this is a start. PR Close #54614
96 lines
2.1 KiB
Text
96 lines
2.1 KiB
Text
load("//tools:defaults.bzl", "jasmine_node_test", "karma_web_test_suite", "ts_library")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
ts_library(
|
|
name = "render3_lib",
|
|
testonly = True,
|
|
srcs = glob(
|
|
["**/*.ts"],
|
|
exclude = [
|
|
"**/*_perf.ts",
|
|
"domino.d.ts",
|
|
"load_domino.ts",
|
|
"is_shape_of.ts",
|
|
"jit_spec.ts",
|
|
"matchers.ts",
|
|
],
|
|
),
|
|
deps = [
|
|
":matchers",
|
|
"//packages:types",
|
|
"//packages/animations",
|
|
"//packages/animations/browser",
|
|
"//packages/animations/browser/testing",
|
|
"//packages/common",
|
|
"//packages/compiler",
|
|
"//packages/core",
|
|
"//packages/core/primitives/signals",
|
|
"//packages/core/rxjs-interop",
|
|
"//packages/core/src/di/interface",
|
|
"//packages/core/src/interface",
|
|
"//packages/core/src/util",
|
|
"//packages/core/testing",
|
|
"//packages/platform-browser",
|
|
"//packages/platform-browser/animations",
|
|
"//packages/platform-browser/testing",
|
|
"//packages/private/testing",
|
|
"@npm//rxjs",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "matchers",
|
|
testonly = True,
|
|
srcs = [
|
|
"is_shape_of.ts",
|
|
"matchers.ts",
|
|
],
|
|
deps = [
|
|
"//packages/core",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "domino",
|
|
testonly = True,
|
|
srcs = [
|
|
"load_domino.ts",
|
|
],
|
|
deps = [
|
|
"//packages/common",
|
|
"//packages/compiler",
|
|
"//packages/platform-server",
|
|
"//packages/platform-server:bundled_domino_lib",
|
|
"//packages/zone.js/lib:zone_d_ts",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "render3_node_lib",
|
|
testonly = True,
|
|
srcs = [],
|
|
deps = [
|
|
":domino",
|
|
":render3_lib",
|
|
],
|
|
)
|
|
|
|
jasmine_node_test(
|
|
name = "render3",
|
|
bootstrap = [
|
|
":domino",
|
|
"//tools/testing:node",
|
|
],
|
|
deps = [
|
|
":render3_node_lib",
|
|
"//packages/zone.js/lib",
|
|
],
|
|
)
|
|
|
|
karma_web_test_suite(
|
|
name = "render3_web",
|
|
deps = [
|
|
":render3_lib",
|
|
],
|
|
)
|