We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 46f3723 commit 88f4872Copy full SHA for 88f4872
lib/model/autocomplete.dart
@@ -348,12 +348,19 @@ class MentionAutocompleteView extends ChangeNotifier {
348
_sortUsers();
349
}
350
351
- final iterator = _sortedUsers!.iterator;
+ final sortedUsers = _sortedUsers!;
352
+ final iterator = sortedUsers.iterator;
353
bool isDone = false;
354
while (!isDone) {
355
// CPU perf: End this task; enqueue a new one for resuming this work
356
await Future(() {});
357
358
+ if (_sortedUsers != sortedUsers) {
359
+ // The list of users this loop has been working from has become stale.
360
+ // Abort so _startSearch can retry with the new list.
361
+ throw ConcurrentModificationError();
362
+ }
363
+
364
if (query != _query || !hasListeners) { // false if [dispose] has been called.
365
return null;
366
0 commit comments