Skip to content

Commit 58a884c

Browse files
CypherPoetCypherPoet
authored andcommitted
fix: keep Receive tab selection after editing
1 parent cfef38f commit 58a884c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Bitkit/Views/Wallets/Receive/ReceiveQr.swift

Lines changed: 5 additions & 2 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,11 @@ 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 {
117+
// Default to the unified ("Auto") tab the first time a Lightning invoice is available.
118+
// Guarded so it does not override the tab the user picked (e.g. after returning from Edit).
119+
if !hasAppliedDefaultTab && tab == nil && !wallet.bolt11.isEmpty {
118120
selectedTab = .unified
121+
hasAppliedDefaultTab = true
119122
}
120123
}
121124
}

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)