Skip to content

Commit b7ca616

Browse files
committed
feat: hide saved connections in explorer when using direct connection
Check for pending startup connection in tree builder to hide saved connections from the start, not just after connection is established.
1 parent f3ebde2 commit b7ca616

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sqlit/domains/explorer/ui/tree/builder.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,22 @@ def refresh_tree(host: TreeMixinHost) -> None:
206206
connecting_name = connecting_config.name if connecting_config else None
207207
connecting_spinner = host._connect_spinner_frame() if connecting_config else None
208208

209+
# Check for active direct connection or pending startup connection
209210
direct_config = getattr(host, "_direct_connection_config", None)
211+
startup_config = getattr(host, "_startup_connect_config", None)
210212
direct_active = (
211213
direct_config is not None
212214
and host.current_config is not None
213215
and direct_config.name == host.current_config.name
214216
)
217+
# Also hide saved connections when startup connection is pending (before it's connected)
218+
startup_pending = startup_config is not None and not any(
219+
c.name == startup_config.name for c in host.connections
220+
)
215221
if direct_active and host.current_config is not None:
216222
connections = [host.current_config]
223+
elif startup_pending:
224+
connections = [startup_config]
217225
else:
218226
connections = list(host.connections)
219227
if connecting_config and not any(c.name == connecting_config.name for c in connections):
@@ -255,14 +263,22 @@ def refresh_tree_chunked(
255263
connecting_name = connecting_config.name if connecting_config else None
256264
connecting_spinner = host._connect_spinner_frame() if connecting_config else None
257265

266+
# Check for active direct connection or pending startup connection
258267
direct_config = getattr(host, "_direct_connection_config", None)
268+
startup_config = getattr(host, "_startup_connect_config", None)
259269
direct_active = (
260270
direct_config is not None
261271
and host.current_config is not None
262272
and direct_config.name == host.current_config.name
263273
)
274+
# Also hide saved connections when startup connection is pending (before it's connected)
275+
startup_pending = startup_config is not None and not any(
276+
c.name == startup_config.name for c in host.connections
277+
)
264278
if direct_active and host.current_config is not None:
265279
connections = [host.current_config]
280+
elif startup_pending:
281+
connections = [startup_config]
266282
else:
267283
connections = list(host.connections)
268284
if connecting_config and not any(c.name == connecting_config.name for c in connections):

0 commit comments

Comments
 (0)