Skip to content

Commit 441d666

Browse files
CypherPoetCypherPoet
authored andcommitted
fix: apply receive tab default only on first appear
1 parent 58a884c commit 441d666

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Bitkit/Views/Wallets/Receive/ReceiveQr.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@ struct ReceiveQr: View {
114114
.padding(.horizontal, 16)
115115
}
116116
.onAppear {
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 {
120-
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 {
121121
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+
}
122126
}
123127
}
124128
}

0 commit comments

Comments
 (0)