fix: reuse existing relationship ref

zio/stable
Anthony Fu 2022-11-29 04:44:50 +08:00
parent 84cdea945f
commit 09e071f6bf
1 changed files with 1 additions and 3 deletions

View File

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