Comments (7)
Hi, booleanSignal i being read in both cases. && operators have to read and evaluate both conditions.
computed(() => this.boolean && this.booleanSignal())
This is not the case - if the first condition is false, the subsequent expression will not be evaluated: https://stackblitz.com/edit/vitejs-vite-gy878w?file=main.js&terminal=dev
from angular.
In that sense, this is "working as intended" from an Angular perspective. However, it does raise the question of whether computed
prohibit (or perhaps warn about) the degenerate case of no dependencies?
from angular.
Are you speaking in terms of like, the language service or compiler giving a warning/error? If so, I think that would be nice.
It can't be compiler, any potential warning would have be runtime
from angular.
from angular.
this is very unintuitive behaviour and shouldn't work like this when documentation states ant computed signal will recompute when signal inside changes.
This should be nuanced with the statement that "computed signal will recompute when accessed signal inside changes". In your second example there is no signal read at all at we were considering a warning in such cases.
from angular.
this is very unintuitive behaviour and shouldn't work like this when documentation states ant computed signal will recompute when signal inside changes.
This should be nuanced with the statement that "computed signal will recompute when accessed signal inside changes". In your second example there is no signal read at all at we were considering a warning in such cases.
Hi, booleanSignal i being read in both cases. && operators have to read and evaluate both conditions.
computed(() => this.boolean && this.booleanSignal())
from angular.
However, it does raise the question of whether computed prohibit (or perhaps warn about) the degenerate case of no dependencies?
Are you speaking in terms of like, the language service or compiler giving a warning/error? If so, I think that would be nice.
from angular.
Related Issues (20)
- Angular SSR don't render HOT 8
- Angular.dev doesn't cover Resolvers or how to fetch dynamic data
- Angular.dev show v0 instead of the latest version v17 HOT 6
- NullInjectorError in combination with standAlone is very unclear? HOT 3
- Router Outlet won't work if router link is in ngTemplate HOT 2
- NullInjectorError: No provider for Firestore2! HOT 1
- angular.dev: youtube embeds are being blocked on firefox HOT 1
- reading required signal input from effect causes error NG0950 when done inside structural directive creating an embedded view after promise resolves HOT 5
- withComponentInputBinding doesn't work as excepted with input signals HOT 1
- Angular 17 @for has memory leak HOT 2
- Reactive forms directives should be standalone HOT 1
- Rename Change detection "Default"
- `swPush.requestSubscription` never resolves on Arc browser (mac os) HOT 1
- AngularGPT
- Recursive template with @defer HOT 7
- The output-function page is not accessible https://angular.dev/guide/output-function
- developer preview features HOT 2
- toSignal causes the signal to not being lazy-evaluated HOT 6
- API for ngModule bootstrap for SSR? - `platformServer.bootstrapModule` vs `bootstrapApplication` of `@angular/platform-server`? HOT 2
- Renderer2 method that allows you to set signal inputs HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.