Instant thread display, faster fetches, trending always shows notes

Threads now render the focused note immediately instead of showing a
loading skeleton. Root + ancestors fetch in parallel, timeouts cut
from 10s to 5s per round-trip, ancestor lookups from 5s to 2s.

Trending feed adds a base recency score so notes always appear even
when engagement data times out from relays.
This commit is contained in:
Jure
2026-03-29 17:50:10 +02:00
parent 8e685f2d4b
commit 2bb1341eed
4 changed files with 27 additions and 23 deletions

View File

@@ -246,10 +246,11 @@ export const useFeedStore = create<FeedState>((set, get) => ({
const eng = engagement.get(note.id) ?? { reactions: 0, replies: 0, zapSats: 0 };
const ageHours = (now - (note.created_at ?? now)) / 3600;
const decay = 1 / (1 + ageHours * 0.15);
const score = (eng.reactions * 1 + eng.replies * 3 + eng.zapSats * 0.01) * decay;
const engScore = eng.reactions * 1 + eng.replies * 3 + eng.zapSats * 0.01;
// Base recency score ensures notes appear even when engagement data times out
const score = (engScore + 0.1) * decay;
return { note, score };
})
.filter((s) => s.score > 0)
.sort((a, b) => b.score - a.score)
.slice(0, 50)
.map((s) => s.note);