Skip to content

Commit 5afbea8

Browse files
committed
fix(send): preserve fee selection across a fee refresh
loadFees reset selectedFeeOption to Fastest on every call, silently clobbering a committed tier (or custom) when mempool rates refresh. Default to Fastest only on the first successful load; preserve the existing selection afterwards. The cache-clear was already gated on an actual rate change.
1 parent 337b47b commit 5afbea8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/features/send/presentation/bloc/send_cubit.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,11 +1179,17 @@ class SendCubit extends Cubit<SendState>
11791179
final ratesChanged =
11801180
state.bitcoinFeesList != bitcoinFees ||
11811181
state.liquidFeesList != liquidFees;
1182+
// Default to Fastest only on the first successful load. Once a
1183+
// selection exists, a fee refresh must preserve it — silently
1184+
// resetting to Fastest would clobber a committed tier (or custom).
1185+
final isFirstLoad = state.bitcoinFeesList == null;
11821186
emit(
11831187
state.copyWith(
11841188
bitcoinFeesList: bitcoinFees,
11851189
liquidFeesList: liquidFees,
1186-
selectedFeeOption: FeeSelection.fastest,
1190+
selectedFeeOption: isFirstLoad
1191+
? FeeSelection.fastest
1192+
: state.selectedFeeOption,
11871193
),
11881194
);
11891195
// Mempool rates changed — preset PSBTs were built at the old

0 commit comments

Comments
 (0)