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
My problem is that the first element that I am going to produce will take a while, but I have to create the AsynReactiveProperty, so I create it with null value.
So, the consumer, instead of waiting and getting the first real value, is getting at the beginning null, because it's the defined value.
I can handle this in two ways in the consumer, checking for null, or using WithoutCurrent in the property.
But for me, both solutions are antipattern, because the consumer has to know too much about the producer, I.E, it needs to know that the first value is not valid, which in this case is not a design decision but an implementation issue.
IMHO, a better solution would be to create the property without any value, some kind of lazy creation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I have this approach:
Producer
Consumer
My problem is that the first element that I am going to produce will take a while, but I have to create the AsynReactiveProperty, so I create it with null value.
So, the consumer, instead of waiting and getting the first real value, is getting at the beginning null, because it's the defined value.
I can handle this in two ways in the consumer, checking for null, or using WithoutCurrent in the property.
But for me, both solutions are antipattern, because the consumer has to know too much about the producer, I.E, it needs to know that the first value is not valid, which in this case is not a design decision but an implementation issue.
IMHO, a better solution would be to create the property without any value, some kind of lazy creation.
Is that possible? Is there maybe other approach?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions