Merge pull request #103 from VashSoftware/hover_thing

child links preload on hover
This commit is contained in:
nick
2026-03-11 20:43:42 -04:00
committed by GitHub
2 changed files with 18 additions and 21 deletions

View File

@@ -17,26 +17,23 @@ export const load: PageServerLoad = async ({ locals }) => {
} }
// ── LOGGED IN → dashboard data ── // ── LOGGED IN → dashboard data ──
const recentMatches = await db.query.match.findMany({ const [recentMatches, liveMatches, [matchCount], [teamCount], [poolCount], [finishedCount], queueStatus] =
await Promise.all([
db.query.match.findMany({
with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } }, with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } },
orderBy: desc(match.createdAt), orderBy: desc(match.createdAt),
limit: 5 limit: 5
}); }),
db.query.match.findMany({
const liveMatches = await db.query.match.findMany({
with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } }, with: { participants: { with: { team: true } }, mappool: { with: { slots: true } } },
where: inArray(match.state, ['LOBBY', 'ROLLING', 'PICKING', 'PLAYING']) where: inArray(match.state, ['LOBBY', 'ROLLING', 'PICKING', 'PLAYING'])
}); }),
db.select({ count: count() }).from(match),
const [matchCount] = await db.select({ count: count() }).from(match); db.select({ count: count() }).from(team),
const [teamCount] = await db.select({ count: count() }).from(team); db.select({ count: count() }).from(mappool),
const [poolCount] = await db.select({ count: count() }).from(mappool); db.select({ count: count() }).from(match).where(eq(match.state, 'FINISHED')),
const [finishedCount] = await db getQueueStatus(locals.user.id)
.select({ count: count() }) ]);
.from(match)
.where(eq(match.state, 'FINISHED'));
const queueStatus = await getQueueStatus(locals.user.id);
return { return {
authenticated: true as const, authenticated: true as const,