From de2bcaac2e3cccd496a3fe107e621cbbf37a4862 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 4 Jun 2025 19:14:20 -0500 Subject: [PATCH] Fix double deleted item --- src/screens/PostThread/index.tsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/screens/PostThread/index.tsx b/src/screens/PostThread/index.tsx index cd25ef1bbf..01b9d98c17 100644 --- a/src/screens/PostThread/index.tsx +++ b/src/screens/PostThread/index.tsx @@ -164,9 +164,10 @@ export function Inner({uri}: {uri: string | undefined}) { const item = thread.data.items[i] /* - * Handle anchor post + * Handle anchor post. Need to check only `depth`, since not found or + * blocked posts are not `threadPost`s, but still have `depth`. */ - if (item.type === 'threadPost' && item.depth === 0) { + if ('depth' in item && item.depth === 0) { results.push(item) // Recalculate total parents current index. @@ -179,9 +180,11 @@ export function Inner({uri}: {uri: string | undefined}) { */ if (!deferParents) { const start = i - 1 - const limit = Math.max(0, start - maxParentCount) - for (let pi = start; pi >= limit; pi--) { - results.unshift(thread.data.items[pi]) + if (start > 0) { + const limit = Math.max(0, start - maxParentCount) + for (let pi = start; pi >= limit; pi--) { + results.unshift(thread.data.items[pi]) + } } } } else {