1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-06 00:49:58 +00:00

fix: reuse existing relationship ref

This commit is contained in:
Anthony Fu 2022-11-29 04:44:50 +08:00
parent 84cdea945f
commit 09e071f6bf

View file

@ -105,9 +105,7 @@ export function useRelationship(account: Account): Ref<Relationship | undefined>
} }
async function fetchRelationships() { async function fetchRelationships() {
const requested = Array.from(requestedRelationships.entries()) const requested = Array.from(requestedRelationships.entries()).filter(([, r]) => !r.value)
requestedRelationships.clear()
const relationships = await useMasto().accounts.fetchRelationships(requested.map(([id]) => id)) const relationships = await useMasto().accounts.fetchRelationships(requested.map(([id]) => id))
for (let i = 0; i < requested.length; i++) for (let i = 0; i < requested.length; i++)
requested[i][1].value = relationships[i] requested[i][1].value = relationships[i]