From e7ef86caff26a471f0815fa883e55556b315fe6c Mon Sep 17 00:00:00 2001 From: Alisher Date: Fri, 24 Jul 2026 11:15:08 +0200 Subject: [PATCH] Resume on the node view when a config already exists (fixes #36) (#40) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit blockchain_ui reopens the first-run config chooser on every launch, even when a node was already configured — the operator has to re-walk the wizard each restart. The backend already restores userConfig from QSettings at construction, so the path is known by the time the module is ready; the view just never acts on it. Route once, on first ready: if a stored userConfig exists, open directly on the node view (StackLayout page 1) instead of the chooser (page 0). This separates first-run onboarding from an already-configured node and removes the restart friction. Routing only — the operator still starts the node from the node view; the existing 'Change' button there is the path back to the chooser. Guarded by a one-shot flag so it never fights manual navigation. Implements ask (b)(i) of #36. Co-authored-by: Alisher Co-authored-by: Claude Opus 4.8 --- src/qml/BlockchainView.qml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/qml/BlockchainView.qml b/src/qml/BlockchainView.qml index 99b7d6a..f18db71 100644 --- a/src/qml/BlockchainView.qml +++ b/src/qml/BlockchainView.qml @@ -27,7 +27,10 @@ Rectangle { function onViewModuleReadyChanged(moduleName, isReady) { if (moduleName === "blockchain_ui") { root.ready = isReady && root.backend !== null - if (root.ready) root.refreshPeerId() + if (root.ready) { + root.refreshPeerId() + root._applyInitialRoute() + } } } } @@ -36,7 +39,10 @@ Rectangle { // Cover the case where the replica is already Valid by the time // we attach the Connections handler. root.ready = root.backend !== null && logos.isViewModuleReady("blockchain_ui") - if (root.ready) root.refreshPeerId() + if (root.ready) { + root.refreshPeerId() + root._applyInitialRoute() + } } // Graceful shutdown: if the window is closed while the node is running, @@ -100,6 +106,21 @@ Rectangle { // node required). Refreshed when ready and whenever the config changes. property string peerId: "" + // Open directly on the node view when a config already exists, instead of + // re-walking the first-run chooser every launch (logos-blockchain-ui#36). + // The backend restores userConfig from QSettings at construction, so the + // path is populated by the time the module is ready. Routing only — the + // operator still starts the node from the node view; the "Change" button + // there is the path back to the chooser (page 0). One-shot, so it never + // overrides a manual return to the chooser. + function _applyInitialRoute() { + if (_d.initialRouted || !root.ready || !root.backend) + return + _d.initialRouted = true + if (root.backend.userConfig && root.backend.userConfig.length > 0) + _d.currentPage = 1 + } + function refreshPeerId() { if (!root.backend || !root.backend.userConfig) { root.peerId = "" @@ -206,6 +227,12 @@ Rectangle { } } property int currentPage: 0 + + // Guards the one-time startup route (see root._applyInitialRoute): + // it must fire once when the module first becomes ready, and never + // fight the user's later navigation (e.g. the node view's "Change" + // button, which deliberately returns to the chooser at page 0). + property bool initialRouted: false } color: Theme.palette.background