fix loading indicator stuck
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/ClosedWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/ClosedWalletViewModel.cs
@@ -11,17 +11,18 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
protected ClosedWalletViewModel(Wallet wallet)
: base(wallet)
{
- Loading = new LoadingViewModel(wallet);
OpenCommand = ReactiveCommand.Create(OnOpen);
}
- public LoadingViewModel Loading { get; }
+ public LoadingViewModel? Loading { get; private set; }
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)
{
base.OnNavigatedTo(isInHistory, disposables);
+ Loading ??= new LoadingViewModel(Wallet);
Loading.Activate(disposables);
+
IsLoading = true;
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/LoadingViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/LoadingViewModel.cs
@@ -19,7 +19,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
[AutoNotify] private string? _statusText;
private Stopwatch? _stopwatch;
- private bool _isLoading;
+ private volatile bool _isLoading;
private uint _filtersToDownloadCount;
private uint _filtersToProcessCount;
private uint _filterProcessStartingHeight;
@@ -29,6 +29,21 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
_wallet = wallet;
_statusText = "";
_percent = 0;
+
+ Services.Synchronizer.WhenAnyValue(x => x.BackendStatus)
+ .Where(status => status == BackendStatus.Connected)
+ .Subscribe(async _ => await LoadWalletAsync(isBackendAvailable: true).ConfigureAwait(false));
+
+ Observable.FromEventPattern<bool>(Services.Synchronizer, nameof(Services.Synchronizer.ResponseArrivedIsGenSocksServFail))
+ .Subscribe(async _ =>
+ {
+ if (Services.Synchronizer.BackendStatus == BackendStatus.Connected)
+ {
+ return;
+ }
+
+ await LoadWalletAsync(isBackendAvailable: false).ConfigureAwait(false);
+ });
}
private uint TotalCount => _filtersToProcessCount + _filtersToDownloadCount;
@@ -51,26 +66,6 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
UpdateStatus(processedCount);
})
.DisposeWith(disposables);
-
- if (!_isLoading)
- {
- Services.Synchronizer.WhenAnyValue(x => x.BackendStatus)
- .Where(status => status == BackendStatus.Connected)
- .Subscribe(async _ => await LoadWalletAsync(isBackendAvailable: true).ConfigureAwait(false))
- .DisposeWith(disposables);
-
- Observable.FromEventPattern<bool>(Services.Synchronizer, nameof(Services.Synchronizer.ResponseArrivedIsGenSocksServFail))
- .Subscribe(async _ =>
- {
- if (Services.Synchronizer.BackendStatus == BackendStatus.Connected)
- {
- return;
- }
-
- await LoadWalletAsync(isBackendAvailable: false).ConfigureAwait(false);
- })
- .DisposeWith(disposables);
- }
}
private uint GetCurrentProcessedCount()

fix loading indicator stuck