UniRx
UniRx copied to clipboard
ToReactiveProperty creates ReadOnlyReactiveProperty
Currently using ToReactiveProperty will create a ReadOnlyReactiveProperty and only return its interface. Due to the interface not being an IDisposable the subscription to the stream (which is created inside the ReadOnlyReactiveProperty) can no longer be disposed.
Why this problem is not resolved for 4+ years? It makes very handy ToReactiveProperty
a bad practice.
Why this problem is not resolved for 4+ years? It makes very handy
ToReactiveProperty
a bad practice.
Because it's not a problem? If you need multiple sources of data merged together, use .Merge(...)
, multicast to Subject
, or any other way of explicit definition of such thing.
Manually pushing values in existing stream of data is asking for GMS-related issues, which is Rx solving in first place.
@elhimp I don't understand how your comment relates to this issue at all.
- If this is not a problem, this issue should be closed by a maintainer explaining why this is not an issue.
- The issue is not about merging multiple sources of data, so your suggestions are pointless - after
.Merge
or any other combination of observable operators you still may want to createReadOnlyReactiveProperty
from it's result for whatever reason. - Why are you talking about manually pushing values to existing stream of data? ReadOnlyReactiveProperty doesn't allow that because it is read only.
The issue is that ToReactiveProperty
creates a subscription you can't dispose. I don't see how anybody can insist that API creating undisposable subscriptions is not an issue.
@Hinidu I get your issue wrong. Sorry.
Your issue is already solved. If you wanna create ReadOnlyReactiveProperty
just use .ToReadOnlyReactiveProperty
Not having more guard rails isn't an issue, unless you're not trying to cater for type of person who tries to dry their hair in microwave.
I also encountered this issue, this is just a leak in every call to ToReactiveProperty
Adding IDisposable
to the interface compiles, I guess this is just a mistake.
Still testing it before doing anything in the main repo
public interface IReadOnlyReactiveProperty<T> : IObservable<T>
->
public interface IReadOnlyReactiveProperty<T> : IObservable<T>, IDisposable
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在忙碌中,无法亲自回复您的邮件,之后将尽快给您回复。
@elhimp I understand why you don't like adding IDisposable to a read only interface.
I would also accept deleting ToReactiveProperty
because there is no way to use it without leaking a subscription
@elhimp I understand why you don't like adding IDisposable to a read only interface. I would also accept deleting
ToReactiveProperty
because there is no way to use it without leaking a subscription
Sure, that's more reasonable.