1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fix conversation view when remote returns error

This commit is contained in:
xmflsct
2023-01-15 21:51:27 +01:00
parent f10d52cebc
commit b52b529550
2 changed files with 41 additions and 32 deletions

View File

@@ -146,33 +146,35 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
return Promise.resolve([{ ...toot }])
}
ancestorsCache.current = context.ancestors.map(ancestor => {
const localMatch = ancestorsCache.current?.find(local => local.uri === ancestor.uri)
if (localMatch) {
return { ...localMatch, _level: 0 }
} else {
return {
...ancestor,
_remote: true,
account: { ...ancestor.account, _remote: true },
mentions: ancestor.mentions.map(mention => ({
...mention,
_remote: true
})),
...(ancestor.reblog && {
reblog: {
...ancestor.reblog,
_remote: true,
account: { ...ancestor.reblog.account, _remote: true },
mentions: ancestor.reblog.mentions.map(mention => ({
...mention,
_remote: true
}))
}
})
if ((ancestorsCache.current?.length || 0) < context.ancestors.length) {
ancestorsCache.current = context.ancestors.map(ancestor => {
const localMatch = ancestorsCache.current?.find(local => local.uri === ancestor.uri)
if (localMatch) {
return localMatch
} else {
return {
...ancestor,
_remote: true,
account: { ...ancestor.account, _remote: true },
mentions: ancestor.mentions.map(mention => ({
...mention,
_remote: true
})),
...(ancestor.reblog && {
reblog: {
...ancestor.reblog,
_remote: true,
account: { ...ancestor.reblog.account, _remote: true },
mentions: ancestor.reblog.mentions.map(mention => ({
...mention,
_remote: true
}))
}
})
}
}
}
})
})
}
const statuses = [{ ...toot }, ...context.descendants]
return statuses.map((status, index) => {
@@ -239,7 +241,8 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
}
)
}
},
onSettled: async () => {
loaded.current = true
if (ancestorsCache.current?.length) {