File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ const { user } = useAtproto()
186186
187187const likeAnimKey = shallowRef (0 )
188188const showLikeFloat = shallowRef (false )
189+ const likeFloatKey = shallowRef (0 )
190+ let likeFloatTimer: ReturnType <typeof setTimeout > | null = null
189191
190192const heartAnimStyle = computed (() => {
191193 if (likeAnimKey .value === 0 ) return {}
@@ -226,9 +228,15 @@ const likeAction = async () => {
226228 likeAnimKey .value ++
227229
228230 if (! currentlyLiked ) {
231+ if (likeFloatTimer !== null ) {
232+ clearTimeout (likeFloatTimer )
233+ likeFloatTimer = null
234+ }
235+ likeFloatKey .value ++
229236 showLikeFloat .value = true
230- setTimeout (() => {
237+ likeFloatTimer = setTimeout (() => {
231238 showLikeFloat .value = false
239+ likeFloatTimer = null
232240 }, 850 )
233241 }
234242
@@ -315,7 +323,13 @@ const likeAction = async () => {
315323 strategy =" fixed"
316324 >
317325 <div :class =" $style.likeWrapper" >
318- <span v-if =" showLikeFloat" aria-hidden =" true" :class =" $style.likeFloat" >+1</span >
326+ <span
327+ v-if =" showLikeFloat"
328+ :key =" likeFloatKey"
329+ aria-hidden =" true"
330+ :class =" $style.likeFloat"
331+ >+1</span
332+ >
319333 <ButtonBase
320334 @click =" likeAction"
321335 size =" medium"
You can’t perform that action at this time.
0 commit comments