René's URL Explorer Experiment


Title: Specify extra effect dependencies without using them inside the effect function · Issue #50916 · angular/angular · GitHub

Open Graph Title: Specify extra effect dependencies without using them inside the effect function · Issue #50916 · angular/angular

X Title: Specify extra effect dependencies without using them inside the effect function · Issue #50916 · angular/angular

Description: Which @angular/* package(s) are relevant/related to the feature request? core Description Allow specifying dependencies without the need to call them inside the effect. That is needed whenever we need to react to a signal change without ...

Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? core Description Allow specifying dependencies without the need to call them inside the effect. That is needed whenever we n...

X Description: Which @angular/* package(s) are relevant/related to the feature request? core Description Allow specifying dependencies without the need to call them inside the effect. That is needed whenever we n...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Specify extra effect dependencies without using them inside the effect function","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\ncore\r\n\r\n### Description\r\n\r\nAllow specifying dependencies without the need to call them inside the effect. That is needed whenever we need to react to a signal change without needing to use the value of that signal inside the effect. For example:\r\n```javascript\r\n// log the below message whenever a task is completed (assuming we have a `completedTasksCount` signal)\r\neffect(() => {\r\n    console.log(\"Congratulations on completing the task!!\")\r\n})\r\n```\r\n\r\n### Proposed solution\r\n\r\nadd `extraDependencies` to [CreateEffectOptions](https://angular.io/api/core/CreateEffectOptions). It will be a list of signals that trigger re-execution of the effect even though they are not used inside the effect.\r\n\r\n```javascript\r\neffect(() => {\r\n    console.log(\"Congratulation on completing the task!!\")\r\n}, {extarDependencies: [completedTasksCount]})\r\n```\r\n\r\nI also thought this new option fits best as the last piece that complements what angular currently has:\r\n- automatic tracking of signals used inside the effect\r\n- ability to [untrack](https://angular.io/guide/signals#reading-without-tracking-dependencies) specific signals even though though they are used inside the effect\r\n\r\n\r\n### Alternatives considered\r\n\r\n#### Add `dependencies` to [CreateEffectOptions](https://angular.io/api/core/CreateEffectOptions).\r\nThe new option will handle both: untracking of signals used inside the effect and tracking of signals not used inside the effect. When `dependencies` is specified, angular should disable its default behavior and only track signals specified in `dependencies`. I actually think this is a better alternative if the feature is approved for implementation. That's because it provides one API for tracking and untracking as opposed to checking the `extraDependencies` to know what forces re-execution of the effect and checking the effect body to see which signals are wrapped inside `untracked`.\r\n\r\n#### tracked(completedTasksCount)\r\nmuch like there is `untracked(counter)`, add `tracked(counter)` to trigger re-execution of the effect. My problem with it is that it can be called anywhere inside the effect. So, there is no one place to check what forces re-execution of the effect.\r\n\r\n#### Check other frontend libraries/frameworks\r\n- Solidjs [on](https://www.solidjs.com/docs/latest/api#on): I went to check if solidjs has sth to deal with these use cases and `on` seemed to be the closest thing. To be honest, I didn't quite understand if it solves the same issue, so I'm only mentioning it here in case it's helpful.\r\n- Preact [effect](https://github.com/preactjs/signals#effectfn): seems like it doesn't allow re-execution of the effect unless a signal is accessed.\r\n- Svelte: the `$:` seems to re-execute only when one of the values referenced inside changes\r\n- Qwik [useTask$](https://qwik.builder.io/docs/guides/qwik-nutshell/#usetask----): doesn't run into the problem because it is explicit about what the effect tracks `taskContext.track(() => page.value)`\r\n- React `useEffect`: doesn't run into the problem because it is explicit about what the effect tracks through `dependencies`\r\n","author":{"url":"https://github.com/ghazi-git","@type":"Person","name":"ghazi-git"},"datePublished":"2023-07-02T11:20:41Z","url":"https://github.com/angular/angular/issues/50916"}

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:503fef5f-47d1-82d4-8c0d-6d07fee3d547
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB006:2454CC:41436F8:52B7D98:6B02244D
html-safe-nonce17d65abdcc59dd5f7e23791843f7ed3ddb3c7c330649eb6c6904b8bf6a8701bd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMDA2OjI0NTRDQzo0MTQzNkY4OjUyQjdEOTg6NkIwMjI0NEQiLCJ2aXNpdG9yX2lkIjoiNTg3NjcxNzM4NTQxNDc0NzIxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd972a9229e1788b5a7408d7f0f55bf8398fb539d3f2648b598b5828947b6d906
hovercard-subject-tagissue:1784591179
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/50916/issue_layout
twitter:imagehttps://opengraph.githubassets.com/549bc3f4d6557ffab2b7147763f2bc3b7f1edeeaa1cc17f4adcbe033aeffce0c/angular/angular/issues/50916
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/549bc3f4d6557ffab2b7147763f2bc3b7f1edeeaa1cc17f4adcbe033aeffce0c/angular/angular/issues/50916
og:image:altWhich @angular/* package(s) are relevant/related to the feature request? core Description Allow specifying dependencies without the need to call them inside the effect. That is needed whenever we n...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameghazi-git
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/50916#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F50916
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%2F50916
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/50916
Reloadhttps://github.com/angular/angular/issues/50916
Reloadhttps://github.com/angular/angular/issues/50916
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/50916
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/50916
Specify extra effect dependencies without using them inside the effect functionhttps://github.com/angular/angular/issues/50916#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/ghazi-git
ghazi-githttps://github.com/ghazi-git
on Jul 2, 2023https://github.com/angular/angular/issues/50916#issue-1784591179
CreateEffectOptionshttps://angular.io/api/core/CreateEffectOptions
untrackhttps://angular.io/guide/signals#reading-without-tracking-dependencies
CreateEffectOptionshttps://angular.io/api/core/CreateEffectOptions
onhttps://www.solidjs.com/docs/latest/api#on
effecthttps://github.com/preactjs/signals#effectfn
useTask$https://qwik.builder.io/docs/guides/qwik-nutshell/#usetask----
https://github.com/zip-fa
zip-fahttps://github.com/zip-fa
on Jul 3, 2023https://github.com/angular/angular/issues/50916#issuecomment-1617949595
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on Jul 3, 2023https://github.com/angular/angular/issues/50916#issuecomment-1618234786
@ghazi-githttps://github.com/ghazi-git
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
cross-cutting: signalshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22cross-cutting%3A%20signals%22
on Jul 3, 2023https://github.com/angular/angular/issues/50916#event-9709075568
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Jul 3, 2023https://github.com/angular/angular/issues/50916#event-9709075984
https://github.com/ghazi-git
ghazi-githttps://github.com/ghazi-git
on Jul 3, 2023https://github.com/angular/angular/issues/50916#issuecomment-1619139219
@zip-fahttps://github.com/zip-fa
preacthttps://github.com/preactjs/signals#guide--api
control flow syntaxhttps://github.com/angular/angular/discussions/50719
https://github.com/ghazi-git
ghazi-githttps://github.com/ghazi-git
on Jul 3, 2023https://github.com/angular/angular/issues/50916#issuecomment-1619146482
@pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
https://github.com/wartab
wartabhttps://github.com/wartab
on Jul 3, 2023https://github.com/angular/angular/issues/50916#issuecomment-1619212305
https://github.com/ghazi-git
ghazi-githttps://github.com/ghazi-git
on Jul 4, 2023https://github.com/angular/angular/issues/50916#issuecomment-1619520659
@wartabhttps://github.com/wartab
automatically unsubscribeshttps://angular.io/guide/rxjs-interop#manualcleanup
takeUntilDestroyedhttps://angular.io/api/core/rxjs-interop/takeUntilDestroyed
https://github.com/wartab
wartabhttps://github.com/wartab
on Jul 4, 2023https://github.com/angular/angular/issues/50916#issuecomment-1619532075
https://github.com/angular/angular/blob/main/packages/core/rxjs-interop/src/to_observable.tshttps://github.com/angular/angular/blob/main/packages/core/rxjs-interop/src/to_observable.ts
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on Jul 5, 2023https://github.com/angular/angular/issues/50916#issuecomment-1621682732
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
not plannedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Jul 5, 2023https://github.com/angular/angular/issues/50916#event-9731229125
https://github.com/ghazi-git
ghazi-githttps://github.com/ghazi-git
on Jul 6, 2023https://github.com/angular/angular/issues/50916#issuecomment-1623001458
@pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
@wartabhttps://github.com/wartab
https://github.com/simeyla
simeylahttps://github.com/simeyla
on Jul 17, 2023https://github.com/angular/angular/issues/50916#issuecomment-1638593404
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Aug 19, 2023https://github.com/angular/angular/issues/50916#issuecomment-1684563895
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Aug 19, 2023https://github.com/angular/angular/issues/50916#event-10134341945
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/50916
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/50916
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.