소스 검색

Fix bug with incorrect scrubber position when scrolling due to incorrectly ordered array of post dom elements: fix by sorting the array

sbkwgh 7 년 전
부모
커밋
4c16b8009c
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      frontend/src/components/routes/Thread.vue

+ 5 - 3
frontend/src/components/routes/Thread.vue

@@ -102,7 +102,7 @@
 				</thread-post-placeholder>
 				<thread-post
 					v-for='(post, index) in posts'
-					:key='post.index'
+					:key='post.id'
 
 					@reply='replyUser'
 					@goToPost='goToPost'
@@ -333,8 +333,10 @@
 			let self = this;
 
 			let postInView = function() {
-				let posts = self.$refs.posts
-				if(!posts) return;
+				if(!self.$refs.posts) return;
+				let posts = self.$refs.posts.sort((a, b) => {
+					return a.post.postNumber - b.post.postNumber;
+				});
 
 				let topPostInView = posts.find(post => {
 					let rect = post.$el.getBoundingClientRect()