Skip to content

Commit 2c9cc65

Browse files
authored
Merge pull request #599 from CypherPoet/fix/receive-tab-persists-after-edit
fix: keep Receive tab selection after editing
2 parents cfef38f + 441d666 commit 2c9cc65

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

Bitkit/Views/Wallets/Receive/ReceiveQr.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct ReceiveQr: View {
1111

1212
@State private var selectedTab: ReceiveTab
1313
@State private var showDetails = false
14+
@State private var hasAppliedDefaultTab = false
1415

1516
init(navigationPath: Binding<[ReceiveRoute]>, cjitInvoice: String? = nil, tab: ReceiveTab? = nil) {
1617
_navigationPath = navigationPath
@@ -113,9 +114,15 @@ struct ReceiveQr: View {
113114
.padding(.horizontal, 16)
114115
}
115116
.onAppear {
116-
// Set default tab to unified if we have a Lightning invoice and no tab was provided
117-
if tab == nil && !wallet.bolt11.isEmpty {
118-
selectedTab = .unified
117+
// Apply the default-tab choice at most once, on the first appearance. The flag is set
118+
// unconditionally here (even before bolt11 is ready) so a later reappearance — e.g.
119+
// returning from Edit once the invoice has loaded — can never override the tab the user picked.
120+
if !hasAppliedDefaultTab {
121+
hasAppliedDefaultTab = true
122+
// Default to the unified ("Auto") tab when a Lightning invoice is already available.
123+
if tab == nil && !wallet.bolt11.isEmpty {
124+
selectedTab = .unified
125+
}
119126
}
120127
}
121128
}

changelog.d/next/599.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The Receive screen now keeps your selected Savings or Spending tab after editing the invoice amount, instead of resetting to Auto.

0 commit comments

Comments
 (0)