fix: Admin Insights actual crash — function props across server/client boundary (v0.55.3)
Server logs (thanks to the user pulling them) showed the real error:
"Functions cannot be passed directly to Client Components" — the server
component page was passing formatShortDate/formatMonth as a `formatDate`
prop into TimeSeriesChart ("use client"). Functions aren't serializable
across the RSC boundary; the two previous fixes (query hardening,
Promise.allSettled) were real improvements but not the actual cause of
the reported crash.
TimeSeriesChart now takes a plain `dateFormat: "day" | "month"` string
and formats internally — BarChart was never affected (its formatValue
prop is only ever used via its own default, never passed from the page).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,11 +34,6 @@ function lastNMonths(n: number): string[] {
|
||||
return out;
|
||||
}
|
||||
|
||||
function formatMonth(m: string) {
|
||||
const [y, mo] = m.split("-");
|
||||
return new Date(Number(y), Number(mo) - 1, 1).toLocaleDateString(undefined, { month: "short", year: "2-digit" });
|
||||
}
|
||||
|
||||
export default async function AdminInsightsPage() {
|
||||
const since = new Date();
|
||||
since.setDate(since.getDate() - DAYS);
|
||||
@@ -128,7 +123,7 @@ export default async function AdminInsightsPage() {
|
||||
<CardDescription>Daily, last {DAYS} days</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<TimeSeriesChart data={signupSeries} formatDate={formatShortDate} />
|
||||
<TimeSeriesChart data={signupSeries} dateFormat="day" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -168,7 +163,7 @@ export default async function AdminInsightsPage() {
|
||||
<CardDescription>Monthly total across all users, last 6 months</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<TimeSeriesChart data={usageSeries} formatDate={formatMonth} />
|
||||
<TimeSeriesChart data={usageSeries} dateFormat="month" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user