fix(studio): connect to the active channel, not hard-coded :50051
Some checks failed
Security / Security check (push) Failing after 1s

Studio defaulted its endpoint to the local channel's port (:50051), but
a curl|sh user is on the production channel (:50071) — so the sidebar
probed a different daemon than the Diagnose page reported, showing
'connected' next to 'production daemon stopped'. On first run Studio now
reads ~/.chain/current-channel (+ run/<ch>.endpoint) and follows the
active channel; an explicit Settings endpoint still wins and persists,
auto-discovery does not (re-follows the channel each launch). The
connection caption now names the channel ('Connected · production') so
it can never look contradictory again.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-06-18 13:52:05 +02:00
parent 5f56abcf5f
commit cb130b2f03
2 changed files with 121 additions and 17 deletions

View file

@ -763,8 +763,11 @@ class _SidebarState extends State<_Sidebar>
Builder(
builder: (context) {
final l = AppLocalizations.of(context)!;
final ch = HubService.instance.connectedChannelName;
final caption = widget.connected == true
? l.connectionConnected
? (ch != null
? '${l.connectionConnected} · $ch'
: l.connectionConnected)
: widget.connected == false
? l.connectionTapToStart
: l.connectionConnecting;
@ -1127,8 +1130,12 @@ class _ConnectionLabel extends StatelessWidget {
final captionColor = connected == false
? theme.colorScheme.error
: theme.colorScheme.onSurface;
// Name the channel the connection is on (production / local / ) so
// "connected" can never look like it contradicts the Diagnose page,
// which reports the *active* channel's daemon.
final ch = HubService.instance.connectedChannelName;
final caption = connected == true
? l.connectionConnected
? (ch != null ? '${l.connectionConnected} · $ch' : l.connectionConnected)
: connected == false
? l.connectionTapToStart
: l.connectionConnecting;