Refactor WotScore fallback to compute only when needed

This commit is contained in:
2026-04-07 04:51:03 +05:30
parent 4ce1971492
commit cc8f26f1d3
+6 -3
View File
@@ -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)