'use client'; import React, { useEffect, useState } from 'react'; interface PostStats { slug: string; cache_hits: number; cache_misses: number; last_interpret_time_ms: number; last_compile_time_ms: number; } export default function RustStatusPage() { const [stats, setStats] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const fetchStats = async () => { setLoading(true); setError(null); try { const res = await fetch('/api/admin/posts?rsparseinfo=1'); if (!res.ok) throw new Error('Failed to fetch stats'); const data = await res.json(); setStats(data); } catch (e: any) { setError(e.message || 'Unknown error'); } finally { setLoading(false); } }; React.useEffect(() => { fetchStats(); const interval = setInterval(fetchStats, 5000); return () => clearInterval(interval); }, []); return (

Rust Parser Status

{loading &&
Loading...
} {error &&
{error}
} {!loading && !error && (
{stats.length === 0 ? ( ) : ( stats.map(stat => ( )) )}
Slug Cache Hits Cache Misses Last Interpret Time (ms) Last Compile Time (ms)
No stats available.
{stat.slug} {stat.cache_hits} {stat.cache_misses} {stat.last_interpret_time_ms} {stat.last_compile_time_ms}
)}
); }