fix(lite): ignore a click on the already-connected server
Clicking the Network-tab card of the server the wallet was already pinned to and connected to tore the controller down and reopened the wallet against the same server. That click is now a no-op. A wallet that failed over to another server still reconnects, which retries the pinned one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include "../../util/i18n.h"
|
#include "../../util/i18n.h"
|
||||||
#include "../../util/lite_server_probe.h"
|
#include "../../util/lite_server_probe.h"
|
||||||
#include "../../wallet/lite_connection_service.h"
|
#include "../../wallet/lite_connection_service.h"
|
||||||
|
#include "../../wallet/lite_wallet_controller.h"
|
||||||
#include "../theme.h"
|
#include "../theme.h"
|
||||||
#include "../layout.h"
|
#include "../layout.h"
|
||||||
#include "../material/type.h"
|
#include "../material/type.h"
|
||||||
@@ -72,6 +73,11 @@ void RenderLiteNetworkTab(App* app)
|
|||||||
|
|
||||||
auto applyAndRebuild = [&]() { st->save(); app->rebuildLiteWallet(/*force=*/true); };
|
auto applyAndRebuild = [&]() { st->save(); app->rebuildLiteWallet(/*force=*/true); };
|
||||||
auto pinServer = [&](const std::string& url) {
|
auto pinServer = [&](const std::string& url) {
|
||||||
|
// Already pinned AND connected to exactly this server: nothing to switch (the click used to tear the
|
||||||
|
// controller down and reopen). A wallet that failed over to another server still reconnects, which
|
||||||
|
// retries the pinned one.
|
||||||
|
auto* lite = app->liteWallet();
|
||||||
|
if (!randomMode && url == sticky && lite && lite->walletOpen() && lite->connectedServerUrl() == url) return;
|
||||||
st->setLiteServerSelectionMode(LiteMode::Sticky);
|
st->setLiteServerSelectionMode(LiteMode::Sticky);
|
||||||
st->setLiteStickyServerUrl(url);
|
st->setLiteStickyServerUrl(url);
|
||||||
applyAndRebuild();
|
applyAndRebuild();
|
||||||
|
|||||||
Reference in New Issue
Block a user