Refactor WotScore fallback to compute only when needed
This commit is contained in:
@@ -45,8 +45,12 @@
|
||||
|
||||
return getFollows($pubkey)
|
||||
})
|
||||
const hasUserFollows = $derived(follows.length > 0)
|
||||
const fallbackScore = $derived.by(() => {
|
||||
const userScoreAvailable = $derived(follows.length > 0)
|
||||
const score = $derived.by(() => {
|
||||
if (userScoreAvailable) {
|
||||
return $userScore
|
||||
}
|
||||
|
||||
const lists = $followLists
|
||||
const mutes = $muteLists
|
||||
|
||||
@@ -68,7 +72,6 @@
|
||||
|
||||
return score
|
||||
})
|
||||
const score = $derived(hasUserFollows ? $userScore : fallbackScore)
|
||||
const active = $derived(follows.includes(target))
|
||||
const normalizedScore = $derived(clamp([0, max], score) / max)
|
||||
const dashOffset = $derived(100 - 44 * normalizedScore)
|
||||
|
||||
Reference in New Issue
Block a user