Parcourir la source

Move if clause out of setTimeout

sbkwgh il y a 8 ans
Parent
commit
ccf73a6166
1 fichiers modifiés avec 4 ajouts et 6 suppressions
  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;