actionbar: don't early return

it's not good practice to early return while rendering,
super easy to introduce flickering

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-08-31 19:29:11 -04:00
parent e9ca793509
commit dea695fa8e

View File

@@ -841,6 +841,8 @@ fn render_note_actionbar(
note_key: NoteKey, note_key: NoteKey,
i18n: &mut Localization, i18n: &mut Localization,
) -> Option<NoteAction> { ) -> Option<NoteAction> {
let mut action = None;
ui.set_min_height(26.0); ui.set_min_height(26.0);
ui.spacing_mut().item_spacing.x = 24.0; ui.spacing_mut().item_spacing.x = 24.0;
@@ -852,11 +854,11 @@ fn render_note_actionbar(
let to_noteid = |id: &[u8; 32]| NoteId::new(*id); let to_noteid = |id: &[u8; 32]| NoteId::new(*id);
if reply_resp.clicked() { if reply_resp.clicked() {
return Some(NoteAction::Reply(to_noteid(note_id))); action = Some(NoteAction::Reply(to_noteid(note_id)));
} }
if quote_resp.clicked() { if quote_resp.clicked() {
return Some(NoteAction::Quote(to_noteid(note_id))); action = Some(NoteAction::Quote(to_noteid(note_id)));
} }
let Zapper { zaps, cur_acc } = zapper?; let Zapper { zaps, cur_acc } = zapper?;
@@ -874,7 +876,7 @@ fn render_note_actionbar(
}; };
if zap_state.is_err() { if zap_state.is_err() {
return Some(NoteAction::Zap(ZapAction::ClearError(target))); action = Some(NoteAction::Zap(ZapAction::ClearError(target.clone())));
} }
let zap_resp = { let zap_resp = {
@@ -891,17 +893,17 @@ fn render_note_actionbar(
.on_hover_cursor(egui::CursorIcon::PointingHand); .on_hover_cursor(egui::CursorIcon::PointingHand);
if zap_resp.secondary_clicked() { if zap_resp.secondary_clicked() {
return Some(NoteAction::Zap(ZapAction::CustomizeAmount(target))); action = Some(NoteAction::Zap(ZapAction::CustomizeAmount(target.clone())));
} }
if !zap_resp.clicked() { if zap_resp.clicked() {
return None; action = Some(NoteAction::Zap(ZapAction::Send(ZapTargetAmount {
}
Some(NoteAction::Zap(ZapAction::Send(ZapTargetAmount {
target, target,
specified_msats: None, specified_msats: None,
}))) })))
}
action
} }
#[profiling::function] #[profiling::function]