From 9dd9080de66f7a8144f998211923a223fbe2e210 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sat, 17 Oct 2026 12:00:01 +0300 Subject: [PATCH] =?UTF-8?q?fix(status-bar):=20a=20result=20without=20a=20m?= =?UTF-8?q?essage=20clears=20the=20status=20text=20instead=20of=20keeping?= =?UTF-8?q?=20'Running=20query=E2=80=A6'=20(#1556)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/ui/querya_shell_status.dart | 5 ++- test/core/ui/querya_shell_status_test.dart | 36 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/lib/core/ui/querya_shell_status.dart b/lib/core/ui/querya_shell_status.dart index 0afdccad..4256cd63 100644 --- a/lib/core/ui/querya_shell_status.dart +++ b/lib/core/ui/querya_shell_status.dart @@ -64,7 +64,10 @@ class QueryaShellStatus extends ChangeNotifier { if (duration != null) _lastQueryDuration = duration; if (rowCount != null) _rowCount = rowCount; if (columnCount != null) _columnCount = columnCount; - if (message != null) _statusMessage = message; + // The message describes this result. A plain row count passes none (the + // counts are shown beside it), and then neither "Running query…" nor the + // text of an earlier run may stay (#1556). + _statusMessage = message; _messageIsBusy = false; notifyListeners(); } diff --git a/test/core/ui/querya_shell_status_test.dart b/test/core/ui/querya_shell_status_test.dart index 710af6c9..7053e5e8 100644 --- a/test/core/ui/querya_shell_status_test.dart +++ b/test/core/ui/querya_shell_status_test.dart @@ -48,6 +48,42 @@ void main() { expect(status.statusMessage, 'Explain failed'); }); + test('a plain-count result leaves no "Running query…" behind (#1556)', () { + status.beginBusy(message: 'Running query…'); + + status.reportQueryResult( + duration: const Duration(milliseconds: 1), + rowCount: 12, + columnCount: 8, + ); + + expect(status.isBusy, isFalse); + expect(status.statusMessage, isNull); + expect(status.rowCount, 12); + expect(status.columnCount, 8); + + status.endBusy(); + expect(status.statusMessage, isNull); + }); + + test('a result without a message does not keep the text of an earlier run', + () { + status.reportQueryResult(rowCount: 3, columnCount: 1, message: 'Script done.'); + status.beginBusy(message: 'Running query…'); + + status.reportQueryResult(rowCount: 12, columnCount: 8); + + expect(status.statusMessage, isNull); + }); + + test('a result with a message shows it after the busy message', () { + status.beginBusy(message: 'Running query…'); + + status.reportQueryResult(message: '3 statements, 5 row(s) affected.'); + + expect(status.statusMessage, '3 statements, 5 row(s) affected.'); + }); + test('a result message is not cleared by a later endBusy', () { status.reportQueryResult(rowCount: 1, columnCount: 1, message: '1 row(s).');