notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit dea695fa8e53bf430e7871e9da26f5919e00568a
parent e9ca7935093ad7c6ca4f236e24a1e537ecff78ad
Author: kernelkind <kernelkind@gmail.com>
Date:   Sun, 31 Aug 2025 19:29:11 -0400

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>

Diffstat:
Mcrates/notedeck_ui/src/note/mod.rs | 22++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/crates/notedeck_ui/src/note/mod.rs b/crates/notedeck_ui/src/note/mod.rs @@ -841,6 +841,8 @@ fn render_note_actionbar( note_key: NoteKey, i18n: &mut Localization, ) -> Option<NoteAction> { + let mut action = None; + ui.set_min_height(26.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); if reply_resp.clicked() { - return Some(NoteAction::Reply(to_noteid(note_id))); + action = Some(NoteAction::Reply(to_noteid(note_id))); } 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?; @@ -874,7 +876,7 @@ fn render_note_actionbar( }; if zap_state.is_err() { - return Some(NoteAction::Zap(ZapAction::ClearError(target))); + action = Some(NoteAction::Zap(ZapAction::ClearError(target.clone()))); } let zap_resp = { @@ -891,17 +893,17 @@ fn render_note_actionbar( .on_hover_cursor(egui::CursorIcon::PointingHand); if zap_resp.secondary_clicked() { - return Some(NoteAction::Zap(ZapAction::CustomizeAmount(target))); + action = Some(NoteAction::Zap(ZapAction::CustomizeAmount(target.clone()))); } - if !zap_resp.clicked() { - return None; + if zap_resp.clicked() { + action = Some(NoteAction::Zap(ZapAction::Send(ZapTargetAmount { + target, + specified_msats: None, + }))) } - Some(NoteAction::Zap(ZapAction::Send(ZapTargetAmount { - target, - specified_msats: None, - }))) + action } #[profiling::function]