interface: skip deleted posts in NoteNavigation

Fixes urbit/landscape#857
This commit is contained in:
Liam Fitzgerald 2021-07-12 12:14:50 +10:00
parent 6256f7d92b
commit 44621ceedc
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -44,7 +44,11 @@ function getAdjacentId(
): BigInteger | null {
const children = Array.from(graph);
const i = children.findIndex(([index]) => index.eq(child));
const target = children[backwards ? i + 1 : i - 1];
let idx = backwards ? i + 1 : i - 1;
let target = children[idx];
while(typeof target?.[1]?.post === 'string') {
target = children[backwards ? idx++ : idx--];
}
return target?.[0] || null;
}