about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2024-06-11 15:01:13 -0700
committerGitHub <noreply@github.com>2024-06-11 15:01:13 -0700
commite1dcd2e4347d5b439dd7f8f94c9727dc4667bb55 (patch)
treeb6380d602a1c67d712492c355fb4c6c0f93dac7d
parenta4ca4db35cbe611a73150eac808fe42c4a6fc8e2 (diff)
downloadvoidsky-e1dcd2e4347d5b439dd7f8f94c9727dc4667bb55.tar.zst
Fix to thread load-more bug (#4488)
-rw-r--r--src/state/queries/post-thread.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts
index 727eff253..a8b1160fb 100644
--- a/src/state/queries/post-thread.ts
+++ b/src/state/queries/post-thread.ts
@@ -94,7 +94,6 @@ export function usePostThreadQuery(uri: string | undefined) {
       if (res.success) {
         const thread = responseToThreadNodes(res.data.thread)
         annotateSelfThread(thread)
-        console.log(thread)
         return thread
       }
       return {type: 'unknown', uri: uri!}
@@ -267,7 +266,7 @@ function annotateSelfThread(thread: ThreadNode) {
       // not a self-thread
       return
     }
-    selfThreadNodes.push(parent)
+    selfThreadNodes.unshift(parent)
     parent = parent.parent
   }
 
@@ -287,7 +286,7 @@ function annotateSelfThread(thread: ThreadNode) {
     for (const selfThreadNode of selfThreadNodes) {
       selfThreadNode.ctx.isSelfThread = true
     }
-    const last = selfThreadNodes.at(-1)
+    const last = selfThreadNodes[selfThreadNodes.length - 1]
     if (last && last.post.replyCount && !last.replies?.length) {
       last.ctx.hasMoreSelfThread = true
     }