mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +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>
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { connection } from "next/server";
|
|
import { InsightsPage } from "@/features/insights/components/insights-page";
|
|
import MonthNavigation from "@/shared/components/month-picker/month-navigation";
|
|
import { parsePeriodParam } from "@/shared/utils/period";
|
|
|
|
type PageSearchParams = Promise<Record<string, string | string[] | undefined>>;
|
|
|
|
type PageProps = {
|
|
searchParams?: PageSearchParams;
|
|
};
|
|
|
|
const getSingleParam = (
|
|
params: Record<string, string | string[] | undefined> | undefined,
|
|
key: string,
|
|
) => {
|
|
const value = params?.[key];
|
|
if (!value) return null;
|
|
return Array.isArray(value) ? (value[0] ?? null) : value;
|
|
};
|
|
|
|
export default async function Page({ searchParams }: PageProps) {
|
|
await connection();
|
|
const resolvedSearchParams = searchParams ? await searchParams : undefined;
|
|
const periodoParam = getSingleParam(resolvedSearchParams, "periodo");
|
|
const { period: selectedPeriod } = parsePeriodParam(periodoParam);
|
|
|
|
return (
|
|
<main className="flex flex-col gap-6">
|
|
<MonthNavigation />
|
|
<InsightsPage period={selectedPeriod} />
|
|
</main>
|
|
);
|
|
}
|