Prevent Save before load
MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
@@ -41,6 +41,7 @@ namespace WalletWasabi.Gui.Tabs
private string _strongPrivacyLevel;
private string _dustThreshold;
private string _pinBoxText;
+ private bool TabOpened { get; set; }
private ObservableAsPropertyHelper<bool> _isPinSet;
@@ -155,6 +156,8 @@ namespace WalletWasabi.Gui.Tabs
}
public override void OnOpen()
+ {
+ try
{
Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");
@@ -202,9 +205,15 @@ namespace WalletWasabi.Gui.Tabs
base.OnOpen();
}
+ finally
+ {
+ TabOpened = true;
+ }
+ }
public override bool OnClose()
{
+ TabOpened = false;
Disposables?.Dispose();
Disposables = null;
@@ -320,6 +329,13 @@ namespace WalletWasabi.Gui.Tabs
private void Save()
{
+ // While the Tab is opening we are setting properties with loading and also LostFocus command called by Avalonia
+ // Those would trigger the Save function before we load the config.
+ if (!TabOpened)
+ {
+ return;
+ }
+
var network = Network;
if (network is null)
{

Prevent Save before load