Should createComputed return a Computed? Or should ReadSignal be implemented slightly differently?
#44
Replies: 3 comments
-
|
I understand that this may be an inconvenience that the IDE brings to ReadSignal. The logic is a bit chaotic, which is why the new reactive system is released as a dev version. I will try to review the logic to see if it can be improved, also to make it work properly with the IDE. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @manuel-plavsic can you check and try #45? |
Beta Was this translation helpful? Give feedback.
-
|
I really like the new logic! It is so much more intuitive. Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I think that the current state of
createComputedis not ideal, since it might be slightly unclear howReadSignal(the type returned bycreateComputed) works under the hood.In the following example,
If someone right clicks on
derived.previousValue, the IDE will bring them toReadSignal'spreviousValue, i.e.:which will not apply since it is explicitly overridden in the
Computedclass. The same applies for otherReadSignalmembers.I propose either:
Computedinstead ofReadSingal(with some potential changes toComputed)ReadSignalinternals so that it no longer contains afinal T _value, but it contains a private setter that can update_valueandpreviousValue. This way, the code forpreviousValue,hasPreviousValueand other affected members could be reused inSignal,Computed, ... and when the user control clicks on these members the code displayed will be valid in case of aComputed.Do you like one of these 2 ideas?
Beta Was this translation helpful? Give feedback.
All reactions