Skip to content

Commit

Permalink
ObservableList Replace Bugfix
Browse files Browse the repository at this point in the history
When replacing, the callback function should refer to the item in the array, rather than generating a new one.
  • Loading branch information
kawaiSky authored Mar 20, 2024
1 parent 20a1c35 commit 5b50267
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ObservableCollections/ObservableList.Views.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private void SourceCollectionChanged(in NotifyCollectionChangedEventArgs<T> e)
// ObservableList does not support replace range
{
var v = (e.NewItem, selector(e.NewItem));
var ov = (e.OldItem, selector(e.OldItem));
var ov = (e.OldItem, list[e.OldStartingIndex].Item2);
list[e.NewStartingIndex] = v;
filter.InvokeOnReplace(v, ov, e.NewStartingIndex);
break;
Expand Down Expand Up @@ -240,4 +240,4 @@ private void SourceCollectionChanged(in NotifyCollectionChangedEventArgs<T> e)
}
}
}
}
}

0 comments on commit 5b50267

Please sign in to comment.