Skip to content

Commit

Permalink
(#436) Fix InvalidOperationException when updating synonyms (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
jibedoubleve authored Jan 4, 2024
1 parent b004794 commit 6c9dea1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Lanceur.Core/BusinessLogic/AliasQueryResultMixin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static IEnumerable<AliasQueryResult> CloneFromSynonyms(this AliasQueryRes

if (errors.Any()) throw new AggregateException($"Errors occured while updating synonyms of alias with these synonyms: {alias.Synonyms}", errors);

return results;
return results.ToList();
}

#endregion Methods
Expand Down
6 changes: 4 additions & 2 deletions src/Lanceur/Views/KeywordsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private void AfterSaveOrUpdateAlias(QueryResult updated)
.Add("TypeOfQueryResult", updated.GetType())
.BeginScope();
// Remove all synonyms ...
var toDel = Aliases.Where(a => a.Id == updated.Id);
var toDel = Aliases.Where(a => a.Id == updated.Id).ToList();
Aliases.Remove(toDel);

// ... and recreate them
Expand All @@ -262,7 +262,9 @@ private void AfterSaveOrUpdateAlias(QueryResult updated)

// Sort and display selected alias
Aliases.SortCollection(criterion => criterion.Name);
SelectedAlias = updatedAlias;
SelectedAlias = Aliases.Where(a=>a.Id == updated.Id)
.Cast<AliasQueryResult>()
.FirstOrDefault() ;
}
catch(Exception ex)
{
Expand Down

0 comments on commit 6c9dea1

Please sign in to comment.