From 35be035850d5a014df9375a51f3d209f8f5368c6 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 6 Jun 2024 08:22:05 -0500 Subject: [PATCH] More zap undo fixes III (#1228) * Fix pending state not immediately updated Before, the bolt wasn't rerendered if the user clicked again within the undo delay since no state changed. * Fix zap undo pulse only shown on hover --- components/upvote.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/upvote.js b/components/upvote.js index 7543558b..b7ca3d40 100644 --- a/components/upvote.js +++ b/components/upvote.js @@ -160,6 +160,7 @@ export default function UpVote ({ item, className }) { if (pending) { controller.abort() + setController(null) return } const c = new ZapUndoController() @@ -186,6 +187,7 @@ export default function UpVote ({ item, className }) { if (pending) { controller.abort() + setController(null) return } const c = new ZapUndoController() @@ -197,7 +199,7 @@ export default function UpVote ({ item, className }) { } } - const fillColor = hover ? nextColor : color + const fillColor = hover || pending ? nextColor : color return (
@@ -222,7 +224,7 @@ export default function UpVote ({ item, className }) { ${meSats ? styles.voted : ''} ${pending ? styles.pending : ''}` } - style={meSats || hover + style={meSats || hover || pending ? { fill: fillColor, filter: `drop-shadow(0 0 6px ${fillColor}90)`