René's URL Explorer Experiment


Title: Explicit Tracking for `effect()`: Request for Reconsideration · Issue #56155 · angular/angular · GitHub

Open Graph Title: Explicit Tracking for `effect()`: Request for Reconsideration · Issue #56155 · angular/angular

X Title: Explicit Tracking for `effect()`: Request for Reconsideration · Issue #56155 · angular/angular

Description: Which @angular/* package(s) are relevant/related to the feature request? core Changelog June 2, 2024: Added section on relying on external libraryes Description We have been refactoring an application towards using Angular's Signals. Dur...

Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? core Changelog June 2, 2024: Added section on relying on external libraryes Description We have been refactoring an applicat...

X Description: Which @angular/* package(s) are relevant/related to the feature request? core Changelog June 2, 2024: Added section on relying on external libraryes Description We have been refactoring an applicat...

Opengraph URL: https://github.com/angular/angular/issues/56155

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Explicit Tracking for `effect()`: Request for Reconsideration","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\ncore\r\n\r\n## Changelog\r\nJune 2, 2024: Added section on relying on external libraryes\r\n\r\n### Description\r\n\r\nWe have been refactoring an application towards using Angular's Signals. During this process, we observed a recurring pattern where effects inevitably require the use of `untracked`. This pattern has revealed several issues:\r\n\r\n1. **Frequent Use of `untracked`:** Developers frequently need to use `untracked` to prevent unintended side effects in signals, making it a standard practice in our codebase.\r\n2. **Error-Prone Nature:** The necessity of `untracked` is not well-known among developers, leading to common errors when it is omitted.\r\n3. **Maintenance Overhead:** Constantly ensuring that `untracked` is correctly applied adds to the maintenance burden and cognitive load on developers.\r\n\r\nTo address these issues, we propose that Angular effects should adopt an explicit tracking model. \r\n\r\n### Proposed solution\r\n\r\n1. **Explicit Declaration:** Developers should explicitly declare dependencies within effects, rather than relying on automatic tracking.\r\n2. **Default Non-Tracking:** By default, effects should not track dependencies unless explicitly specified, reducing the need for `untracked`.\r\n\r\n**Example Scenario:**\r\nCurrently, developers write:\r\n\r\n```typescript\r\n\r\nid = input.required\u003cnumber>();\r\n\r\neffect(() => {\r\n  // Part 1: Tracking\r\n  const id = this.id();\r\n\r\n  // Part 2: Execution\r\n  untracked(() => {\r\n    this.dataService.load(id);\r\n  });\r\n})\r\n```\r\n\r\nWith explicit tracking, it would look like:\r\n\r\n```typescript\r\nid = input.required\u003cnumber>();\r\n\r\neffect(this.id, (id) => {\r\n  this.dataService.load(id);\r\n});\r\n```\r\n\r\n**Benefits:**\r\n\r\n1. **Reduced Errors:** Explicit tracking minimizes the risk of overlooking `untracked`, leading to more predictable and stable code.\r\n2. **Improved Developer Experience:** Clearer dependency management simplifies understanding and maintaining the code.\r\n3. **Enhanced Performance:** Explicit tracking can optimize performance by avoiding unnecessary re-computations and side effects.\r\n\r\n**Internal API and Library Ecosystem:**\r\nIt is noteworthy that some parts of the internal Angular API already utilize automatic `untracked`. While this is beneficial, other libraries face similar problems and would benefit if the untracking responsibility was handled by the caller. This approach can provide more consistent and error-free usage across different codebases and libraries.\r\n\r\n** External Libraries:**\r\nIt has been suggested that this change be implemented as an external library instead. Most application developers are not aware of explicit tracking, though, and would not expect implicit tracking, leading to bugs. Relying on an external library requires developers to be aware of the problem and actively seek out a solution.\r\n\r\nReference: https://github.com/angular/angular/issues/56155#issuecomment-2137760839\r\n\r\n**Prior Discussion:**\r\nThis issue was previously raised in \r\n- [Issue #54548](https://github.com/angular/angular/issues/54548#issuecomment-1961712985)\r\n- [PR 54614](https://github.com/angular/angular/pull/54614)\r\n\r\n\r\nThank you for considering this enhancement.\r\n\r\n### Alternatives considered\r\n\r\n- Introducing a fourth \"effect-like\" function with explicit tracking\r\n- Keep it as it is","author":{"url":"https://github.com/rainerhahnekamp","@type":"Person","name":"rainerhahnekamp"},"datePublished":"2024-05-29T13:00:15Z","url":"https://github.com/angular/angular/issues/56155"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:27856d67-3c04-2477-4ba2-4b7796388b53
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9C6A:3F8AB1:3CA3C6C:4D030F3:6B01EFA1
html-safe-nonced8ea0f5b04f5c0727cd350e99472f6ddb459e9fe6ed2dddc3455cc7ca9f852f2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzZBOjNGOEFCMTozQ0EzQzZDOjREMDMwRjM6NkIwMUVGQTEiLCJ2aXNpdG9yX2lkIjoiNTQ1Mzc4NDc3NDU5MjI5NDgxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac232e4ba0868c9b582e76c616457c2a7695d64e5b638ea23177111d0069e5fdaf
hovercard-subject-tagissue:2323271824
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/56155/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0643479e4482b0c3b4c5a7f6305050e2f6ec9b9ae1269ecef65f1137d177884d/angular/angular/issues/56155
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0643479e4482b0c3b4c5a7f6305050e2f6ec9b9ae1269ecef65f1137d177884d/angular/angular/issues/56155
og:image:altWhich @angular/* package(s) are relevant/related to the feature request? core Changelog June 2, 2024: Added section on relying on external libraryes Description We have been refactoring an applicat...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerainerhahnekamp
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/56155#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F56155
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F56155
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/56155
Reloadhttps://github.com/angular/angular/issues/56155
Reloadhttps://github.com/angular/angular/issues/56155
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests142 (142)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/56155
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/56155
Explicit Tracking for effect(): Request for Reconsiderationhttps://github.com/angular/angular/issues/56155#top
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: reactivityWork related to fine-grained reactivity in the core frameworkhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20reactivity%22
cross-cutting: signalshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20signals%22
needsTriagehttps://github.com/angular/angular/milestone/83
https://github.com/rainerhahnekamp
rainerhahnekamphttps://github.com/rainerhahnekamp
on May 29, 2024https://github.com/angular/angular/issues/56155#issue-2323271824
#56155 (comment)https://github.com/angular/angular/issues/56155#issuecomment-2137760839
Issue #54548https://github.com/angular/angular/issues/54548#issuecomment-1961712985
PR 54614https://github.com/angular/angular/pull/54614
Nexthttps://github.com/angular/angular/issues/56155?timeline_page=1
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: reactivityWork related to fine-grained reactivity in the core frameworkhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20reactivity%22
on May 29, 2024https://github.com/angular/angular/issues/56155#event-12971553879
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on May 29, 2024https://github.com/angular/angular/issues/56155#event-12971554226
https://github.com/HaasStefan
HaasStefanhttps://github.com/HaasStefan
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137478609
https://github.com/rainerhahnekamp
rainerhahnekamphttps://github.com/rainerhahnekamp
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137487748
@HaasStefanhttps://github.com/HaasStefan
https://github.com/mauriziocescon
mauriziocesconhttps://github.com/mauriziocescon
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137756817
#56098https://github.com/angular/angular/issues/56098
https://stackblitz.com/edit/stackblitz-starters-lt4skr?file=src%2Fitems.service.tshttps://stackblitz.com/edit/stackblitz-starters-lt4skr?file=src%2Fitems.service.ts
https://www.solidjs.com/tutorial/reactivity_onhttps://www.solidjs.com/tutorial/reactivity_on
https://vuejs.org/guide/essentials/watchers#eager-watchershttps://vuejs.org/guide/essentials/watchers#eager-watchers
https://github.com/JeanMeche
JeanMechehttps://github.com/JeanMeche
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137760839
ngxtension/ngxtension-platform#393https://github.com/ngxtension/ngxtension-platform/pull/393
https://github.com/mauriziocescon
mauriziocesconhttps://github.com/mauriziocescon
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137775069
@JeanMechehttps://github.com/JeanMeche
https://svelte.dev/examples/reactive-statementshttps://svelte.dev/examples/reactive-statements
https://vuejs.org/guide/essentials/watchers.htmlhttps://vuejs.org/guide/essentials/watchers.html
https://solidjs.com/docs/latest/api#onhttps://solidjs.com/docs/latest/api#on
https://github.com/HaasStefan
HaasStefanhttps://github.com/HaasStefan
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137777541
@JeanMechehttps://github.com/JeanMeche
https://github.com/rainerhahnekamp
rainerhahnekamphttps://github.com/rainerhahnekamp
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137783126
@JeanMechehttps://github.com/JeanMeche
https://github.com/msmallest
msmallesthttps://github.com/msmallest
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2137994258
https://github.com/Harpush
Harpushhttps://github.com/Harpush
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2138006986
#54614 (comment)https://github.com/angular/angular/pull/54614#issuecomment-1966283955
https://github.com/garrettld
garrettldhttps://github.com/garrettld
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2138211261
https://angular.dev/guide/signals#use-cases-for-effectshttps://angular.dev/guide/signals#use-cases-for-effects
https://react.dev/learn/you-might-not-need-an-effecthttps://react.dev/learn/you-might-not-need-an-effect
https://github.com/e-oz
e-ozhttps://github.com/e-oz
on May 29, 2024https://github.com/angular/angular/issues/56155#issuecomment-2138225058
my articlehttps://medium.com/@eugeniyoz/angular-signals-reactive-context-and-dynamic-dependency-tracking-d2d6100568b0
@garrettldhttps://github.com/garrettld
JeanMechehttps://github.com/JeanMeche
on May 22, 2026https://github.com/angular/angular/issues/56155#event-25849067305
feat(core): explicit effecthttps://github.com/JeanMeche/angular/commit/00b7828adecf3027fa5866da555aba9ee1a54b4d
https://docs.github.com/articles/closing-issues-via-commit-messages
00b7828https://github.com/JeanMeche/angular/commit/00b7828adecf3027fa5866da555aba9ee1a54b4d
feat(core): explicit effecthttps://github.com/JeanMeche/angular/commit/c4fc14b2f71876925e1f908af6a03787dad57d4b
https://docs.github.com/articles/closing-issues-via-commit-messages
c4fc14bhttps://github.com/JeanMeche/angular/commit/c4fc14b2f71876925e1f908af6a03787dad57d4b
feat(core): explicit effecthttps://github.com/JeanMeche/angular/commit/60cee91da23ad2e5ab617b22e78656ee13c5b92d
https://docs.github.com/articles/closing-issues-via-commit-messages
60cee91https://github.com/JeanMeche/angular/commit/60cee91da23ad2e5ab617b22e78656ee13c5b92d
feat(core): explicit effecthttps://github.com/JeanMeche/angular/commit/e71a22d4739199afbbeec207972756348dc8aa1b
https://docs.github.com/articles/closing-issues-via-commit-messages
e71a22dhttps://github.com/JeanMeche/angular/commit/e71a22d4739199afbbeec207972756348dc8aa1b
feat(core): explicit effecthttps://github.com/JeanMeche/angular/commit/b07bf134c07b5ae6997bf6779339919f45668e0f
https://docs.github.com/articles/closing-issues-via-commit-messages
b07bf13https://github.com/JeanMeche/angular/commit/b07bf134c07b5ae6997bf6779339919f45668e0f
feat(core): Introduce `splitEffect`, an `effect` with an untracked ef…https://github.com/JeanMeche/angular/commit/6cc5d01e9597903c8045ff180408b5ab5ff22c7e
https://docs.github.com/articles/closing-issues-via-commit-messages
6cc5d01https://github.com/JeanMeche/angular/commit/6cc5d01e9597903c8045ff180408b5ab5ff22c7e
feat(core): Introduce `splitEffect`, an `effect` with an untracked ef…https://github.com/JeanMeche/angular/commit/29f32ea950f87d9d0a6b2bf253349df7f8b9e03d
https://docs.github.com/articles/closing-issues-via-commit-messages
29f32eahttps://github.com/JeanMeche/angular/commit/29f32ea950f87d9d0a6b2bf253349df7f8b9e03d
feat(core): split tracking for `effect` and `afterRenderEffect`https://github.com/JeanMeche/angular/commit/5182787fcfe527536c96b7afdeed9828e70367b5
https://docs.github.com/articles/closing-issues-via-commit-messages
5182787https://github.com/JeanMeche/angular/commit/5182787fcfe527536c96b7afdeed9828e70367b5
feat(core): split tracking for `effect` and `afterRenderEffect`https://github.com/JeanMeche/angular/commit/2b29c9f2173084a5d3de3c240315d052d9ba1c45
https://docs.github.com/articles/closing-issues-via-commit-messages
2b29c9fhttps://github.com/JeanMeche/angular/commit/2b29c9f2173084a5d3de3c240315d052d9ba1c45
feat(core): split tracking for `effect` and `afterRenderEffect`https://github.com/JeanMeche/angular/commit/62aeb53b9fc96d9bfb74f18b96a74da0bbb0bf39
https://docs.github.com/articles/closing-issues-via-commit-messages
62aeb53https://github.com/JeanMeche/angular/commit/62aeb53b9fc96d9bfb74f18b96a74da0bbb0bf39
https://github.com/JeanMeche
JeanMechehttps://github.com/JeanMeche
on May 24, 2026https://github.com/angular/angular/issues/56155#issuecomment-4529720394
#68703https://github.com/angular/angular/pull/68703
#68908https://github.com/angular/angular/pull/68908
https://github.com/wall-street-dev
wall-street-devhttps://github.com/wall-street-dev
on May 25, 2026https://github.com/angular/angular/issues/56155#issuecomment-4531788607
https://github.com/mauriziocescon
mauriziocesconhttps://github.com/mauriziocescon
on May 25, 2026https://github.com/angular/angular/issues/56155#issuecomment-4532516165
https://github.com/imaksp
imaksphttps://github.com/imaksp
on May 25, 2026https://github.com/angular/angular/issues/56155#issuecomment-4532775159
#68703https://github.com/angular/angular/pull/68703
#68908https://github.com/angular/angular/pull/68908
https://vuejs.org/guide/essentials/watchers#eager-watchershttps://vuejs.org/guide/essentials/watchers#eager-watchers
https://github.com/JanTheMan1010
JanTheMan1010https://github.com/JanTheMan1010
on Jun 3, 2026https://github.com/angular/angular/issues/56155#issuecomment-4612531884
onhttps://docs.solidjs.com/reference/reactive-utilities/on-util
@JeanMechehttps://github.com/JeanMeche
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/56155
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/56155
area: coreIssues related to the framework runtimehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20core%22
core: reactivityWork related to fine-grained reactivity in the core frameworkhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22core%3A%20reactivity%22
cross-cutting: signalshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20signals%22
needsTriageNo due datehttps://github.com/angular/angular/milestone/83
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.