Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.28.0
* add notifyWhenEqual to projectListSplices so equal changes aren't filtered out

## 0.27.0
* added notifyWhenEqual flag to ObservableMap

Expand Down
4 changes: 2 additions & 2 deletions lib/src/async/differs/list_differ.dart
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,14 @@ List<ListChangeRecord<E>> _createInitialSplices<E>(
// insert incorrectly, because those items will be shifted.
List<ListChangeRecord<E>> projectListSplices<E>(
List<E> list, List<ListChangeRecord<E>> records,
[Equality<E>? equality]) {
{Equality<E>? equality, bool notifyWhenEqual = false}) {
equality ??= DefaultEquality<E>();
if (records.length <= 1) return records;
final splices = <ListChangeRecord<E>>[];
final initialSplices = _createInitialSplices(list, records);
for (final splice in initialSplices) {
if (splice.addedCount == 1 && splice.removed.length == 1) {
if (splice.removed[0] != list[splice.index]) {
if (notifyWhenEqual || splice.removed[0] != list[splice.index]) {
splices.add(splice);
}
continue;
Expand Down
4 changes: 3 additions & 1 deletion lib/src/async/observable_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ class ObservableList<E> extends ListBase<E>

bool deliverListChanges() {
if (_listRecords == null) return false;
final records = projectListSplices<E>(this, _listRecords!);
//projectListSplices removes equal entries so skip the call when requested
final records = projectListSplices<E>(this, _listRecords!,
notifyWhenEqual: notifyWhenEqual);
_listRecords = null;

if (hasListObservers && records.isNotEmpty) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: change_notifier
version: 0.27.0
version: 0.28.0
description: Support for marking objects as observable
homepage: https://github.com/angulardart-community/change_notifier
environment:
Expand Down
Loading