Skip to content

Commit

Permalink
Update pkgs/cronet_http/example/lib/main.dart
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Bosch <[email protected]>
  • Loading branch information
brianquinlan and natebosch authored Nov 6, 2023
1 parent 744e4c8 commit cc71e49
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkgs/cronet_http/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ class _HomePageState extends State<HomePage> {
}

final books = await _findMatchingBooks(query);
if (query == _lastQuery) {
// Avoid the situation where a slow-running query finishes late and
// replaces newer search results.
setState(() {
_books = books;
});
}
// Avoid the situation where a slow-running query finishes late and
// replaces newer search results.
if (query != _lastQuery) return;
setState(() {
_books = books;
});
}

@override
Expand Down

0 comments on commit cc71e49

Please sign in to comment.