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.
-
I think that the current state of
createComputed
is 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
Computed
class. The same applies for otherReadSignal
members.I propose either:
Computed
instead ofReadSingal
(with some potential changes toComputed
)ReadSignal
internals so that it no longer contains afinal T _value
, but it contains a private setter that can update_value
andpreviousValue
. This way, the code forpreviousValue
,hasPreviousValue
and 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