File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change 44<MainNavButtons />
55
66<form @onsubmit =" @ExecuteSearch" >
7- <input @bind =" searchTerm " placeholder =" Search for mods" >
7+ <input @bind =" SearchTerm " placeholder =" Search for mods" >
88 <button type =" submit" >Search</button >
99</form >
1010
4040 private GithubModSearchEngine github = new (" Spore-Community/ModBrowser" );
4141
4242 [SupplyParameterFromQuery (Name = " search" )]
43- private string searchTerm { get ; set ; } = " " ;
43+ private string SearchTerm { get => _searchTerm ; set => _searchTerm = value ?? " " ; }
44+ private string _searchTerm = " " ;
4445
4546 private List <ModListing > mods = new ();
4647
4748 protected override async Task OnInitializedAsync ()
4849 {
49- // If the search term is empty, we want to list all mods
50- if (string .IsNullOrWhiteSpace (searchTerm ))
51- {
52- searchTerm = " " ;
53- }
54-
5550 await ExecuteSearch ();
5651 }
5752
6156 mods .Clear ();
6257 try
6358 {
64- await foreach (var mod in github .SearchModsAsync (searchTerm ))
59+ await foreach (var mod in github .SearchModsAsync (SearchTerm ))
6560 {
6661 mods .Add (mod );
6762
6863 // When listing all mods, sort by download count
69- if (searchTerm .Length == 0 )
64+ if (SearchTerm .Length == 0 )
7065 {
7166 mods = mods .OrderByDescending (mod => mod .DownloadCount ).ToList ();
7267 }
You can’t perform that action at this time.
0 commit comments