Pārlūkot izejas kodu

Move if clause out of setTimeout

sbkwgh 8 gadi atpakaļ
vecāks
revīzija
ccf73a6166
1 mainītis faili ar 4 papildinājumiem un 6 dzēšanām
  1. 4 6
      src/components/routes/Thread.vue

+ 4 - 6
src/components/routes/Thread.vue

@@ -142,12 +142,10 @@
 							window.scrollTo(0, postTop - header - 32)
 
 							this.highlightedPostIndex = i
-
-							setTimeout(() => {
-								if(this.highlightedPostIndex === i) {
-									this.highlightedPostIndex = null
-								}
-							}, 3000)
+							
+							if(this.highlightedPostIndex === i) {
+								setTimeout(() => this.highlightedPostIndex = null, 3000)
+							}
 						})
 
 						break;