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:
parent
09f9efa189
commit
35be035850
|
@ -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)`
|
||||||
|
|
Loading…
Reference in New Issue