You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is unnecessarily heavy for most use cases. Additionally, it is possible that the internal computed could end up as a Consumer for one of the read signals, making it persist in memory beyond the end of the utility function.
I think a utility like observeReads should be added to the spec, though obviously with a cheaper implementation, designed for occasions when the callback does not need to be reactively re-invoked.
The case I have in mind is for writing a check that no Signals are read in a callback. This is important in contexts where Signals are expected to be passed around, not invoked.
It would be harmful if people invoked that API as bindClassNameValue(node, myClassNames.get()) on accident, so a framework could monitor and throw errors if any signals are read at inappropriate times.
The text was updated successfully, but these errors were encountered:
The current best way to get a list of signals read during a callback is through a function like this
This is unnecessarily heavy for most use cases. Additionally, it is possible that the internal
computed
could end up as aConsumer
for one of the read signals, making it persist in memory beyond the end of the utility function.I think a utility like
observeReads
should be added to the spec, though obviously with a cheaper implementation, designed for occasions when the callback does not need to be reactively re-invoked.The case I have in mind is for writing a check that no Signals are read in a callback. This is important in contexts where Signals are expected to be passed around, not invoked.
Imagine an API like this:
It would be harmful if people invoked that API as
bindClassNameValue(node, myClassNames.get())
on accident, so a framework could monitor and throw errors if any signals are read at inappropriate times.The text was updated successfully, but these errors were encountered: