Ionosphere.tv
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf: add ?meta=true to getTrack to avoid 12MB+ SSR fetches

Track pages were fetching 12-17MB responses server-side just to extract
lightweight metadata. The full data is already fetched client-side by
TrackViewContent. This was causing OOM kills on the 512MB web machines.

New getTrackMeta() fetches only slug/name/room/talks (~50KB) for SSR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+22 -3
+15
apps/ionosphere-appview/src/routes.ts
··· 631 631 if (!stream) return c.json({ error: "missing stream parameter" }, 400); 632 632 const data = getTrackData(db, stream); 633 633 if (!data) return c.json({ error: "stream not found" }, 404); 634 + 635 + // ?meta=true returns only lightweight fields (for SSR — avoids 12MB+ responses) 636 + if (c.req.query("meta") === "true") { 637 + return c.json({ 638 + slug: data.slug, 639 + name: data.name, 640 + room: data.room, 641 + dayLabel: data.dayLabel, 642 + streamUri: data.streamUri, 643 + durationSeconds: data.durationSeconds, 644 + playbackUrl: data.playbackUrl, 645 + talks: data.talks, 646 + }); 647 + } 648 + 634 649 return c.json(data); 635 650 }); 636 651
+3 -3
apps/ionosphere/src/app/tracks/[stream]/page.tsx
··· 1 - import { getTrack, getTracks } from "@/lib/api"; 1 + import { getTrackMeta, getTracks } from "@/lib/api"; 2 2 import type { Metadata } from "next"; 3 3 import TrackViewContent from "./TrackViewContent"; 4 4 ··· 13 13 14 14 export async function generateMetadata({ params }: { params: Promise<{ stream: string }> }): Promise<Metadata> { 15 15 const { stream } = await params; 16 - const data = await getTrack(stream); 16 + const data = await getTrackMeta(stream); 17 17 return { 18 18 title: `${data.name} — Ionosphere`, 19 19 description: `${data.talks.length} talks from ${data.room}, ATmosphereConf 2026`, ··· 25 25 26 26 // Only pass lightweight metadata as props — the heavy data (words, diarization, 27 27 // transcript) is fetched client-side to avoid serializing 10MB+ into the HTML. 28 - const data = await getTrack(stream); 28 + const data = await getTrackMeta(stream); 29 29 const meta = { 30 30 slug: data.slug, 31 31 name: data.name,
+4
apps/ionosphere/src/lib/api.ts
··· 62 62 return fetchApi<any>(`/xrpc/tv.ionosphere.getTrack?stream=${encodeURIComponent(stream)}`); 63 63 } 64 64 65 + export async function getTrackMeta(stream: string) { 66 + return fetchApi<any>(`/xrpc/tv.ionosphere.getTrack?stream=${encodeURIComponent(stream)}&meta=true`); 67 + } 68 + 65 69 export async function getCorrections(stream: string) { 66 70 const res = await fetch(`${API_BASE}/xrpc/tv.ionosphere.getCorrections?stream=${encodeURIComponent(stream)}`, { cache: "no-store" }); 67 71 if (!res.ok) throw new Error(`API error: ${res.status}`);