mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-10 03:11:46 +00:00
Todas as queries cacheadas do dashboard migram de `unstable_cache` para
a diretiva `use cache` com `cacheTag` e `cacheLife({ revalidate: 3 })`.
Todas as páginas e o layout do dashboard passam a chamar `connection()`
para garantir renderização dinâmica. O root layout envolve os filhos em
`<Suspense>`. `next.config.ts` remove `turbopackFileSystemCacheForDev`
e adota `cacheComponents: true`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { connection } from "next/server";
|
|
import { MonthlyCalendar } from "@/features/calendar/components/monthly-calendar";
|
|
import { fetchCalendarData } from "@/features/calendar/queries";
|
|
import {
|
|
getSingleParam,
|
|
type ResolvedSearchParams,
|
|
} from "@/features/transactions/page-helpers";
|
|
import MonthNavigation from "@/shared/components/month-picker/month-navigation";
|
|
import { getUserId } from "@/shared/lib/auth/server";
|
|
import type { CalendarPeriod } from "@/shared/lib/types/calendar";
|
|
import { parsePeriodParam } from "@/shared/utils/period";
|
|
|
|
type PageSearchParams = Promise<ResolvedSearchParams>;
|
|
|
|
type PageProps = {
|
|
searchParams?: PageSearchParams;
|
|
};
|
|
|
|
export default async function Page({ searchParams }: PageProps) {
|
|
await connection();
|
|
const userId = await getUserId();
|
|
const resolvedParams = searchParams ? await searchParams : undefined;
|
|
|
|
const periodoParam = getSingleParam(resolvedParams, "periodo");
|
|
const { period, monthName, year } = parsePeriodParam(periodoParam);
|
|
|
|
const calendarData = await fetchCalendarData({
|
|
userId,
|
|
period,
|
|
});
|
|
|
|
const calendarPeriod: CalendarPeriod = {
|
|
period,
|
|
monthName,
|
|
year,
|
|
};
|
|
|
|
return (
|
|
<main className="flex flex-col gap-3">
|
|
<MonthNavigation />
|
|
<MonthlyCalendar
|
|
period={calendarPeriod}
|
|
events={calendarData.events}
|
|
formOptions={calendarData.formOptions}
|
|
/>
|
|
</main>
|
|
);
|
|
}
|