Simplify observable pipelines
MODIFY
WalletWasabi.Fluent/Controls/PrivacyContentControl.axaml.cs
WalletWasabi.Fluent/Controls/PrivacyContentControl.axaml.cs
@@ -37,13 +37,11 @@ public class PrivacyContentControl : ContentControl
this.WhenAnyValue(x => x.ForceShow));
IsContentRevealed = displayContent
- .Replay(1)
- .RefCount();
+ .ReplayLastActive();
PrivacyText =this.WhenAnyValue(x => x.NumberOfPrivacyChars)
- .Select(n => TextHelpers.GetPrivacyMask((int) NumberOfPrivacyChars))
- .Replay(1)
- .RefCount();
+ .Select(n => TextHelpers.GetPrivacyMask((int) n))
+ .ReplayLastActive();
}
private IObservable<string> PrivacyText { get; } = Observable.Empty<string>();

MODIFY
WalletWasabi.Fluent/Extensions/ObservableExtension.cs
WalletWasabi.Fluent/Extensions/ObservableExtension.cs
@@ -18,4 +18,9 @@ public static class ObservableExtension
.Concat();
public static IObservable<Unit> ToSignal<T>(this IObservable<T> source) => source.Select(_ => Unit.Default);
+
+ public static IObservable<T> ReplayLastActive<T>(this IObservable<T> observable)
+ {
+ return observable.Replay(1).RefCount();
+ }
}

Simplify observable pipelines