Skip to content

Commit 794821d

Browse files
committed
Address coderabbitai nitpicks
1 parent 14d6ba8 commit 794821d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/dart/lib/src/utils/parse_live_list.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ class ParseLiveList<T extends ParseObject> {
178178
);
179179
}
180180

181-
query.keysToReturn(keys);
181+
// Deduplicate keys to minimize request size
182+
query.keysToReturn(keys.toSet().toList());
182183
}
183184

184185
return await query.query<T>();
@@ -630,8 +631,12 @@ class ParseLiveList<T extends ParseObject> {
630631
);
631632
}
632633
} else {
633-
// Object not found (possibly deleted between initial query and load)
634-
// Don't emit error - LiveQuery will send a deletion event to handle this
634+
// Object not found (possibly deleted between initial query and load).
635+
// Note: Element remains loaded=false, so subsequent getAt() calls will
636+
// retry the query. This is acceptable because:
637+
// 1. LiveQuery will send a delete event to remove the element if needed
638+
// 2. Retries are rare (object would need to be deleted mid-load)
639+
// 3. No error is emitted to avoid alarming users for transient issues
635640
if (_debug) {
636641
print('ParseLiveList: Element at index $index not found during load');
637642
}
@@ -732,6 +737,8 @@ class ParseLiveElement<T extends ParseObject> extends ParseLiveListElement<T> {
732737
if (includeObject != null) {
733738
queryBuilder.includeObject(includeObject);
734739
}
740+
// Fire-and-forget initialization; errors surface through element stream
741+
// ignore: unawaited_futures
735742
_init(object, loaded: loaded);
736743
}
737744

0 commit comments

Comments
 (0)