correctly dispose subscription.
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -48,16 +48,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
ExchangeRate = walletVm.Wallet.Synchronizer.UsdExchangeRate;
PriorLabels = new();
- walletVm.Wallet.TransactionProcessor.WhenAnyValue(x => x.Coins)
- .ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(x =>
- {
- PriorLabels.Clear();
- PriorLabels.AddRange(x.SelectMany(x => x.HdPubKey.Label.Labels).Distinct());
- });
-
this.WhenAnyValue(x => x.To)
- .ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(ParseToField);
PasteCommand = ReactiveCommand.CreateFromTask(async () =>
@@ -76,6 +67,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
});
}
+
+
private void ParseToField(string s)
{
if (_parsingUrl)
@@ -159,9 +152,19 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
protected override void OnNavigatedTo(bool inStack, CompositeDisposable disposables)
{
_owner.Wallet.Synchronizer.WhenAnyValue(x => x.UsdExchangeRate)
+ .ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x => ExchangeRate = x)
.DisposeWith(disposables);
+ _owner.Wallet.TransactionProcessor.WhenAnyValue(x => x.Coins)
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(x =>
+ {
+ PriorLabels.Clear();
+ PriorLabels.AddRange(x.SelectMany(coin => coin.HdPubKey.Label.Labels).Distinct());
+ })
+ .DisposeWith(disposables);
+
base.OnNavigatedTo(inStack, disposables);
}

correctly dispose subscription.