Fix double deleted item

This commit is contained in:
Eric Bailey
2025-06-04 19:14:20 -05:00
parent 1f07e01c1e
commit de2bcaac2e
+8 -5
View File
@@ -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 {