File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,11 +94,21 @@ class _MysqlStatsViewState extends material.State<MysqlStatsView> {
9494
9595 Future <void > _fetch () async {
9696 final conn = _lease? .connection;
97- if (conn == null || ! conn.isConnected) return ;
97+ if (conn == null || ! conn.isConnected) {
98+ if (! mounted) return ;
99+ setState (() {
100+ _error = 'Not connected' ;
101+ _loading = false ;
102+ });
103+ return ;
104+ }
98105 try {
99106 final stats = await conn.serverStats ();
100107 if (! mounted) return ;
101- if (! replaceIfChanged (_stats, stats, (v) => _stats = v)) return ;
108+ if (! replaceIfChanged (_stats, stats, (v) => _stats = v)) {
109+ if (_loading) setState (() => _loading = false );
110+ return ;
111+ }
102112 setState (() => _loading = false );
103113 } catch (e) {
104114 if (! mounted) return ;
Original file line number Diff line number Diff line change @@ -165,7 +165,15 @@ class _MysqlTableViewState extends material.State<MysqlTableView> {
165165
166166 Future <void > _fetch ({bool refreshCount = false }) async {
167167 final conn = _connection;
168- if (conn == null || ! conn.isConnected) return ;
168+ if (conn == null || ! conn.isConnected) {
169+ if (mounted && _loading) {
170+ setState (() {
171+ _error = 'Not connected' ;
172+ _loading = false ;
173+ });
174+ }
175+ return ;
176+ }
169177 if (_customSqlActive) {
170178 await _fetchCustom ();
171179 return ;
@@ -218,7 +226,15 @@ class _MysqlTableViewState extends material.State<MysqlTableView> {
218226
219227 Future <void > _fetchCustom () async {
220228 final conn = _connection;
221- if (conn == null || ! conn.isConnected) return ;
229+ if (conn == null || ! conn.isConnected) {
230+ if (mounted && _loading) {
231+ setState (() {
232+ _error = 'Not connected' ;
233+ _loading = false ;
234+ });
235+ }
236+ return ;
237+ }
222238 final sql = _customSql;
223239 if (sql == null || sql.isEmpty) return ;
224240 if (! mounted) return ;
Original file line number Diff line number Diff line change @@ -104,11 +104,25 @@ class _PostgresStatsViewState extends material.State<PostgresStatsView> {
104104
105105 Future <void > _fetch () async {
106106 final c = _connection;
107- if (c == null || ! c.isConnected) return ;
107+ if (c == null || ! c.isConnected) {
108+ if (! mounted) return ;
109+ setState (() {
110+ _error = 'Not connected' ;
111+ _loading = false ;
112+ });
113+ return ;
114+ }
108115 try {
109116 final stats = await c.serverStats ();
110117 if (! mounted) return ;
111- if (! replaceIfChanged (_stats, stats, (v) => _stats = v)) return ;
118+ if (! replaceIfChanged (_stats, stats, (v) => _stats = v)) {
119+ if (_loading) {
120+ setState (() {
121+ _loading = false ;
122+ });
123+ }
124+ return ;
125+ }
112126 setState (() {
113127 _loading = false ;
114128 });
Original file line number Diff line number Diff line change @@ -156,7 +156,15 @@ class _PostgresTableViewState extends material.State<PostgresTableView> {
156156 /// [refreshCount] runs `COUNT(*)` (e.g. first load or Refresh). Pagination only runs SELECT.
157157 Future <void > _fetch ({bool refreshCount = false }) async {
158158 final conn = _connection;
159- if (conn == null || ! conn.isConnected) return ;
159+ if (conn == null || ! conn.isConnected) {
160+ if (mounted && _loading) {
161+ setState (() {
162+ _error = 'Not connected' ;
163+ _loading = false ;
164+ });
165+ }
166+ return ;
167+ }
160168 if (_customSqlActive) {
161169 await _fetchCustom ();
162170 return ;
@@ -219,7 +227,15 @@ class _PostgresTableViewState extends material.State<PostgresTableView> {
219227
220228 Future <void > _fetchCustom () async {
221229 final conn = _connection;
222- if (conn == null || ! conn.isConnected) return ;
230+ if (conn == null || ! conn.isConnected) {
231+ if (mounted && _loading) {
232+ setState (() {
233+ _error = 'Not connected' ;
234+ _loading = false ;
235+ });
236+ }
237+ return ;
238+ }
223239 final sql = _customSql;
224240 if (sql == null || sql.isEmpty) return ;
225241 if (! mounted) return ;
Original file line number Diff line number Diff line change @@ -113,7 +113,15 @@ class _SqliteTableViewState extends material.State<SqliteTableView> {
113113
114114 Future <void > _fetch ({bool refreshCount = false }) async {
115115 final conn = _connection;
116- if (conn == null || ! conn.isConnected) return ;
116+ if (conn == null || ! conn.isConnected) {
117+ if (mounted && _loading) {
118+ setState (() {
119+ _error = 'Not connected' ;
120+ _loading = false ;
121+ });
122+ }
123+ return ;
124+ }
117125 setState (() {
118126 _loading = true ;
119127 _error = null ;
You can’t perform that action at this time.
0 commit comments