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
This commit is contained in:
ekzyis 2024-06-06 08:22:05 -05:00 committed by GitHub
parent 09f9efa189
commit 35be035850
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -160,6 +160,7 @@ export default function UpVote ({ item, className }) {
if (pending) { if (pending) {
controller.abort() controller.abort()
setController(null)
return return
} }
const c = new ZapUndoController() const c = new ZapUndoController()
@ -186,6 +187,7 @@ export default function UpVote ({ item, className }) {
if (pending) { if (pending) {
controller.abort() controller.abort()
setController(null)
return return
} }
const c = new ZapUndoController() 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 ( return (
<div ref={ref} className='upvoteParent'> <div ref={ref} className='upvoteParent'>
@ -222,7 +224,7 @@ export default function UpVote ({ item, className }) {
${meSats ? styles.voted : ''} ${meSats ? styles.voted : ''}
${pending ? styles.pending : ''}` ${pending ? styles.pending : ''}`
} }
style={meSats || hover style={meSats || hover || pending
? { ? {
fill: fillColor, fill: fillColor,
filter: `drop-shadow(0 0 6px ${fillColor}90)` filter: `drop-shadow(0 0 6px ${fillColor}90)`