When a user typed a query, onChanged already ran _runSearch and results settled. Pressing Enter then triggered onSubmitted, firing a second IMAP search whose response could arrive in a different order — silently reordering the visible list so the tile at position 0 no longer corresponded to the email the user tapped.
Fixed by guarding onSubmitted: it now skips _runSearch when results are already present (_searchResults != null) or a search is already in flight (_searchLoading).
Added a regression test that verifies list order is unchanged after pressing Enter on an already-settled search.
flutter test test/widget/email_list_screen_test.dart — all 24 tests pass, including the new "pressing Enter after search settles does not reorder results"
Manually: type a query in folder view search, wait for results to settle, press Enter — list order must not change
## Summary
- When a user typed a query, `onChanged` already ran `_runSearch` and results settled. Pressing Enter then triggered `onSubmitted`, firing a second IMAP search whose response could arrive in a different order — silently reordering the visible list so the tile at position 0 no longer corresponded to the email the user tapped.
- Fixed by guarding `onSubmitted`: it now skips `_runSearch` when results are already present (`_searchResults != null`) or a search is already in flight (`_searchLoading`).
- Added a regression test that verifies list order is unchanged after pressing Enter on an already-settled search.
Closes #473
## Test plan
- `flutter test test/widget/email_list_screen_test.dart` — all 24 tests pass, including the new "pressing Enter after search settles does not reorder results"
- Manually: type a query in folder view search, wait for results to settle, press Enter — list order must not change
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
onChangedalready ran_runSearchand results settled. Pressing Enter then triggeredonSubmitted, firing a second IMAP search whose response could arrive in a different order — silently reordering the visible list so the tile at position 0 no longer corresponded to the email the user tapped.onSubmitted: it now skips_runSearchwhen results are already present (_searchResults != null) or a search is already in flight (_searchLoading).Closes #473
Test plan
flutter test test/widget/email_list_screen_test.dart— all 24 tests pass, including the new "pressing Enter after search settles does not reorder results"🤖 Generated with Claude Code