fix: welcome page should use a shared singleton instance to manage and filter repositories (#117)

This commit is contained in:
leo 2024-05-07 14:12:33 +08:00
parent 06ca29b2b2
commit 4af8cc18d2
5 changed files with 5 additions and 11 deletions

View file

@ -9,10 +9,7 @@ namespace SourceGit.ViewModels
{
public class Welcome : ObservableObject
{
public bool IsClearSearchVisible
{
get => !string.IsNullOrEmpty(_searchFilter);
}
public static Welcome Instance => _instance;
public AvaloniaList<RepositoryNode> RepositoryNodes
{
@ -25,10 +22,7 @@ namespace SourceGit.ViewModels
set
{
if (SetProperty(ref _searchFilter, value))
{
Referesh();
OnPropertyChanged(nameof(IsClearSearchVisible));
}
}
}
@ -205,6 +199,7 @@ namespace SourceGit.ViewModels
}
}
private static Welcome _instance = new Welcome();
private string _searchFilter = string.Empty;
}
}